mysql - How to use array in select query where statement in php? -
i have code this:
$sql11 = "select room_no guestrocordtransc roomtype='".$roomtype."'"; $retval11 = mysql_query( $sql11, $conn ); while($row11 = mysql_fetch_array($retval11,mysql_assoc)) { $cid_room=$row11['roomno']; }
here i'm getting array of room numbers, stored in $cid_room
.
now, need $cid_room
in select query fetch particular room_no not in guestrocordtransac
.
my second query looks this:
$sql = "select room_no roominfo room_no not in( select roomno guestrocordtransac roomtype='".$roomtype."' between '".$check_in."' , '".$check_out."' , cid='".$cid_room."') , roomtype='".$roomtype."'";
is possible give array value ($cid_room
) in query, check value.
if $cid_room not multi-dimensional array, use array in select query that:
"select room_no roominfo room_no not in (".implode(',',$cid_room).") , roomtype='".$roomtype."'";
but ' m not sure works in case.
Comments
Post a Comment