I need help using LIKE in mysql php , false returns all the time -
i have php page , should search string sent , in column of mysql table . code is:
$search=$_post['search']; $search_result= mysql_query('select * table title '.$search.'%');
the connection ok return false time !
your query bad, this:
select * table title foo%
when should like:
select * table title 'foo%'
so change line to:
$search_result= mysql_query("select * table title '". $search ."%'");
or simply:
$search_result= mysql_query("select * table title '$search%'");
and, always, script vulnerable sql injection, mysql_*
functions deprecated, use pdo or mysqli instead, blah, blah, usual song , dance of minions of php tag.
Comments
Post a Comment