What's the sql should look like to get all possible data when using multiple select,
such as:
<select name="hostfield[]" multiple>
....
$hostId=$_POST['hostfield[]'];
$q="SELECT date,time,host,msg FROM logs WHERE host='$hostId' ....
What's the sql should look like to get all possible data when using multiple select,
such as:
<select name="hostfield[]" multiple>
....
$hostId=$_POST['hostfield[]'];
$q="SELECT date,time,host,msg FROM logs WHERE host='$hostId' ....
Assuming you have something like:
$hostfield = array(1,2,3,4,5);
$query = "select * from table where id in (";
$query.= implode(",",$hostfield);
$query.= ")";
print $query;
Originally posted by Sxooter
Assuming you have something like:
$hostfield = array(1,2,3,4,5); $query = "select * from table where id in ("'; $query.= implode("','",$hostfield); $query.= "')"; print $query;
[/B]
little change is maybe better....
$hostfield = array(1,2,3,4,5);
$query = "select * from table where id in ('";
$query.= implode("','",$hostfield);
$query.= "')";
print $query;
hth