*Solved*SQL syntax error in search code
Posted: Tue Apr 19, 2005 7:19 am
Can anyone see anything wrong with the sql syntax in this code keep getting error message, for example if I enter 'a' in the search box I get the error message
Error in query: You have an error in your SQL syntax near 'WHERE name LIKE 'a%'' at line 5
Code: Select all
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname]=$value;
$query = "SELECT
name, organisation,website,stu_id
FROM studentwebsites ORDER BY organisation
WHERE name LIKE '$formVars[name]%'";