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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -