Jump to content

check records in table


robert_gsfame

Recommended Posts

i have let say table1 with this kind of record  "James, King, Ronald, Steve" inside the column created

 

and i want to check whether what user want is there...therefore i use this query

 

 

$check=mysql_query(sprintf("SELECT * FROM table1 WHERE column LIKE '%%{$userinput}%%'",

mysql_real_escape_string($userinput)));

 

$numrows=mysql_num_rows($check);

if(empty($numrows)){

echo "no result";}else{

echo "yes it's there";}

 

 

when i put cheryl and start searching it then i will have the correct answer which is "no result"....but when i put only one letter "a" then i'll get "yes it's there"

 

I wish to have "yes it's there" output only when user type James, or King or Ronald or Steve

 

how can i do that? thx

Link to comment
https://forums.phpfreaks.com/topic/198896-check-records-in-table/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.