I have a DB (quartos) created with the following structure:
id_quarto tipo_quarto vista_quarto |
a Single Mar |
b Single Mar |
c Single M
You have extra $row = mysql_fetch_array($rs);
just after mysql_query($strSQL);
. Then in while
loop you read $row
again (second row in resultset).
So your code will look
$strSQL = "SELECT id_quarto FROM quartos
WHERE tipo_quarto='". $_POST['tipo_quarto'] ."'
AND vista_quarto='". $_POST['vista_quarto'] ."'";
$rs = mysql_query($strSQL);
// $row = mysql_fetch_array($rs); Don't need this line!!!
while($row = mysql_fetch_array($rs))
{
// output ....
}
Also, it always makes sense to add code for handling mysql errors.