I am trying to transfer a number that I get from my SQL statement. I know that the statement will only come up with one row of information:
As seen, a variable in the session already has the room type, and got the SQL statement to work of that. the same applies for the $hotelSQLID. But I cant seem to get the $something to get the value. The $hotelBookingRow['$hotelBookingRoom'] either means $hotelBookingRow['singleroom'] or ...['doubleroom'] as these are the field names, with each field that has a number only which is what i am trying to get out.
thanks,
carlos
PHP:
<?
if($_SESSION["hotelRoom"]=="single"){ $hotelBookingRoom='singleroom';}
if($_SESSION["hotelRoom"]=="double"){ $hotelBookingRoom='doubleroom';}
$hotelSQLID=$_SESSION['hotel'];
// SQL connection
$myConn=mysql_connect("databaselocation","user","password");
mysql_select_db("database");
$hotelBookingStrSQL="select $hotelBookingRoom from hotel where Id='$hotelSQLID'";
$hotelBooking=mysql_query($hotelBookingStrSQL,$myConn);
where($hotelBookingRow=mysql_fetch_array($hotelBooking)){
$something=$hotelBookingRow['$hotelBookingRoom'];
}
echo $something;
?>
As seen, a variable in the session already has the room type, and got the SQL statement to work of that. the same applies for the $hotelSQLID. But I cant seem to get the $something to get the value. The $hotelBookingRow['$hotelBookingRoom'] either means $hotelBookingRow['singleroom'] or ...['doubleroom'] as these are the field names, with each field that has a number only which is what i am trying to get out.
thanks,
carlos