I have run into a problem. I have a form which I am trying to add an edit page to insert into mysql. I am getting all the rooms from one table and then I have to check if they are "checked" in another table.
Table 1 (HotelRooms):
ID | HotelRoom | Hid
---------------------
1 | Standard | 20
2 | Deluxe | 20
2 | Basic | 20
Table 2 (HotelPromos)
ID | Promo | Rooms | Hid
-------------------------
1 | 10% | deluxe, standard | 20
Now in my form I first need to find all rooms belonging to Hotel with Hid 20. so here is my select statement for that:
<?php
$getRooms = mysql_query("SELECT HotelRoom FROM HotelRooms WHERE HotelId = '$hid'") or die(mysql_error());
$rr = 1;
$numRooms = mysql_num_rows($getRooms);
if($numRooms == 0){
echo "Lo sentimos pero no hay habitaciones registrados para este hotel. Favor de agregar habitacion para poder agregar una promocion.";
}
while($ro = mysql_fetch_array($getRooms)){
$roomName = $ro['HotelRoom'];
?>
<input type="checkbox" name="room<?php echo $rr ?>" /><?php echo $roomName ?>
<?php
$rr++;
}
?>
Does anyone know how I can check the HotelPromos table to see if it is under the column Rooms and add a checked="checked" to it???
Any help would be greatly apreciated!!!