concat condition not working in php pdo but running in mySQL -


running following query works in user search, within mysql on phpmyadmin.

select user_id, fname, lname, email users fname '%scott james%' or lname '%scott james%' or concat(fname,' ',lname) '%scott james%' 

however, if try , run through php on production environment, seems fall over. got ideas?

$word = $_request['search'];  $search_query='select user_id, fname, lname, email users fname :search or lname :search or concat(fname,' ',lname) :search';  $stmt= $conn->prepare($search_query); $stmt->execute(array(   ':search'   => '%'.$word.'%',   ':user_id'   => $user_id      )); 

  1. make sure pdo in emulation mode allow multiple parameters same name
  2. get rid of ':user_id' => $user_id stuff.
  3. make sure pdo in exception mode , can see php errors

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -