I have a page where information from 2 tables is displayed in a form so the user can amend the information. The code used is below and that seems to get the information I want.
$amendbooking = mysql_query("SELECT * FROM Bookings LEFT JOIN Rooms ON
Bookings.BOOKING_ID = Rooms.Bookings_BOOKING_ID WHERE BOOKING_ID='$BOOKING_ID'" );
while ($myrow = mysql_fetch_array($amendbooking))
{
mysql_close();
Then, after amending the information is sent via the save button and actions the following
or die ("Sorry - could not connect to the guests database");
$BOOKING_ID=$HTTP_POST_VARS['BOOKING_ID'];
$Guests_Guest_ID=$HTTP_POST_VARS['Guests_Guest_ID'];
$DATE_FROM=$HTTP_POST_VARS['DATE_FROM'];
$DATE_TO=$HTTP_POST_VARS['DATE_TO'];
$NO_OF_PEOPLE=$HTTP_POST_VARS['NO_OF_PEOPLE'];
$Room_Type=$HTTP_POST_VARS['Room_Type'];
$query =("UPDATE Bookings SET Guests_Guest_ID='$Guests_Guest_ID', DATE_FROM='$DATE_FROM', DATE_TO='$DATE_TO', NO_OF_PEOPLE='$NO_OF_PEOPLE' WHERE BOOKING_ID='$BOOKING_ID'");
$result=mysql_query($query);
if ($result) {
header('Location: amendresult.php?confirm=Success');
}//end if result
else {
echo "<b>ERROR: unable to post - Try Logging in again</b>";
}//end else
All this is on one page. I am getting a 'Success' report on the next page, but the database is not being updated.
I also tried echoing the variable values to the screen, just after the $Room_Type=$HTTP_POST_VARS['Room_Type']; line
I have been looking at this all morning and can't see why it won't update.
Any help would be appreciated.