Hi There,
I want to use a search term as a limiter in a SQL Query. (ie if someone searches for "chair", I want to use the term 'chair' as part of the WHERE/HAVING clause.
I have 2 php pages, one for the search form (using the $_POST variables to send the search terms to the second php page) and the php page to process the query & display the results.
I have tried a couple of things but any time I try and use $_POST['item'] in a WHERE/HAVING clause, but I get an error that I do not understand. π
My Select statement:
$sql="SELECT main.amwsid, main.name2, main.name1, links.url FROM main, links WHERE main.amwsid=links.amwsid GROUP BY main.amwsid HAVING main.name1=$_POST["surname"]";
The error:
Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\WWWRoot\amws_test\test.php3 on line 6
I suspect that it's something to do with the value not yet being filled therefore there's nothing to select with.
Any help would be fabulous, thanks!
Andrewπ