I have a select box in my PHP & mysql code like.
<select id="addressbook_user" name ="addressbook_user">
<option value="hi">hi</option>
<option value="hello">hello</option>
<option value="newa">newa</option>
<select>
I am storing the selected value in a jQuery list and i am passing that list to the php code to filter the other options except list items like.
$list = $_GET['list'];
print $list;
print_r($list);
$query = "SELECT * from demo_addressbook WHERE user_created_id IN(SELECT id FROM demo_user WHERE user_name = '$get_user_name') AND type = 1 AND guest_name NOT IN '$list' ";
$sresult = mysql_query($query) or die (mysql_error());
and based on the result i am trying to create the latest select box without selected value of the list .
but unfortunately my above query is not working
hiYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'hi' at line 1 is the error .
Please suggest me the best way to filter the array data from a mysql table
wrap the variable with
parenthesis