I have multiple select options.
<select name="uid" multiple>
<option value="001">001</option>
<option value="002">002</option>
<option value="003">003</option>
</select>
I want to query data in mysql. For ex, If I choose uid 001 & 003, then the data for uid 001 & 003 will be shown.
$get_uid = $_GET['uid'];
$query = mysql_query("SELECT * FROM t_user WHERE uid = '$uid'");
So how can I set the query for multiple value select.
Try this code
$get_uid = $_GET['uid']; //array
if (count($get_uid) > 0) {
$get_uid = implode(',', $get_uid); //string;
$query = mysql_query("SELECT * FROM t_user WHERE uid IN ($get_uid)");
}
Try this...
$get_uid = implode(",",$_GET['uid']);
$query = mysql_query("SELECT * FROM t_user WHERE uid IN ($get_uid)");