zulubanshee Posted November 27, 2010 Share Posted November 27, 2010 I have a search string that keeps returning 1064 error. Here it is: "SELECT link FROM links WHERE id_person_fk IN (select id from person where name LIKE '$personname'"; The $personname string is like this "firstname lastname" id_person_fk is a foreign key, if that matters. I can get this search to work if i type it in straight sql and fill in the personname explicitly, but I cannot get it to work in a php script with a variable. There are no extra space characters at the end or beginning of the string. I suspect the problem lies in the fact that there is a space in the person name, but I can't confirm. personname in the person table is a varchar data type, if that matters. Link to comment https://forums.phpfreaks.com/topic/220018-problem-with-searchstring-in-php/ Share on other sites More sharing options...
Pikachu2000 Posted November 27, 2010 Share Posted November 27, 2010 Have you echoed the query string to the browser to make sure it's formed as you'd expect it to be formed? Since the query executes when hard coded, this is unlikely to be a MySQL issue, so moving thread to PHP Help. Link to comment https://forums.phpfreaks.com/topic/220018-problem-with-searchstring-in-php/#findComment-1140419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.