I have a mysql query which is being to find the stock items in a certain location belonging to a certain group. Hence this is going through 4 levels of while loops. No i have given the user the ability to select the locations they want to view the stocks from. This is being achieved using checkboxes which are sent using ajax in an array. The array exploded in PHP using $offices = explode(",", $locations);. However now i want to use the locations selected in my mysql query.
$location are in the form of location1, location2, location3, location4
//selecting all locations using the statement below, however i want to select the locations that where selected by user.
$sql4 = mysql_query("select OfficeID, OfficeTitle from Office where 'wanted locations');
while($row3 = mysql_fetch_array($sql4)) {
$curr_location = $row3[0];
$sql3 = mysql_query("select Quantity from Stock_Management where Book_ID = '$curr_book' and Location_ID = '$curr_location'");
while($row3 = mysql_fetch_array($sql3)) {
echo "<td>".$row3[0]."</td>";
}
}
echo "</tr>";
I want to select the locations based on the selected locations by user, now this can be achievable using a for loop by i don't know how to include that in my sql query!