mysql - why is this query in SQL/PHP not working? -


i have sql query made in php. query resulst in error. if remove and first_name '{$first_name}%', works fine , produces right output. unable follow wrong below syntax. appreciated. thanks

$db = new pdo("mysql:dbname=newbie");             $first_name=$_get["firstname"];             $first_name =$db->quote($first_name);             $last_name=$_get["lastname"];             $last_name=$db->quote($last_name);             $rows=$db->query("select id,first_name actors last_name=$last_name , first_name '{$first_name}%' order film_count desc limit 1");  

i think because missed quotes on $lastname, given text-field.

$db = new pdo("mysql:dbname=newbie");             $first_name=$_get["firstname"];             $first_name =$db->quote($first_name);             $last_name=$_get["lastname"];             $last_name=$db->quote($last_name);             $rows=$db->query("select id,first_name actors last_name='{$last_name}' , first_name '{$first_name}%' order film_count desc limit 1"); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -