0

Emm.. You can mark this thread as solved if all your questions have been answered. If you are extremely happy with Maxmumford's help, you can add to his reputation. Click on 'Add to MaxMumford's Reputation', click on 'I approve', type your comment and Click the button!

0

Hi
I do have one more question if you could help me with I promises this will be my last question :
When user use (changebooking) page and click on submit to change their booking details, what will be the if statement which should be used in the (change_booking_details) page to search the clients table for the bookingID number and then if it’s not found give the user message saying ( Sorry we don’t have a record for the booking ID number you have typed ) and allow them to go back to retype the number again.

For your information below is the code which I am using for the (change_booking_details) page.

Regards

<html>
<head>
<title>change Booking  Details</title>
</head>

<body>
<?php
// Have they entered a BookingID?
if(empty($_POST['bookingID']))
{
	die("Please enter your correct BookingID number.");
}

$con = mysql_connect("xxxxxxxx","xxxxxx","xxxxxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("xxxxxxxx", $con);



$result = mysql_query("SELECT * FROM clients WHERE clientID=$_POST[bookingID]");

while($row = mysql_fetch_array($result))
  {
  print "Hi";
  echo(" ");
  echo $row['firstname'] . " " . $row['surname'];
  echo(" ");
  echo("welcome back you can change your booking using the form below  ");
  echo "<br />";
  }
//print "Welcome back you can change your booking using the below form";


mysql_close($con)
?>
<p> hi </p>
<form name="form1" method="post" action="../actions/booking_updated.php">
  <table width="75%" border="1">
    <tr>
      <td>Bookin ID</td>
      <td><input type="text" name="bookingID"></td>
    </tr>
    <tr> 
      <td width="34%">Arrival Date</td>
      <td width="66%"> <input name="startdate" type="text" id="startdate" maxlength="10">
        (yyyy-mm-dd) </td>
    </tr>
    <tr> 
      <td>Departure Date</td>
      <td><input name="enddate" type="text" id="enddate" maxlength="10">
        (yyyy-mm-dd) </td>
    </tr>
    <tr> 
      <td>Room Type</td>
      <td><select name="roomtype" id="roomtype">
          <option value="Single">Single</option>
          <option value="Double">Double</option>
          <option value="Suite" selected>Suite</option>
        </select></td>
    </tr>
    <tr> 
      <td>Number of Adults:</td>
      <td><select name="adults" id="adults">
          <option value="1">1</option>
          <option value="2">2</option>
        </select></td>
    </tr>
    <tr> 
      <td>Number of Children:</td>
      <td><select name="children" id="children">
          <option value="0">0</option>
          <option value="1">1</option>
          <option value="2">2</option>
        </select></td>
    </tr>
    <tr> 
      <td>Special Requirments</td>
      <td><textarea name="requirements" cols="30" id="requirements"></textarea></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td><input name="updatebooking" type="submit" id="updatebooking" value="Update Booking"></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<p>&nbsp;</p>
</body>
</html>
0

Use mysql_num_rows($result) For example,

$query = "select *from table where id='".$_POST['id']."'";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0 ) {
//record exists
} else {
//record doesnt exit
}
0

This did not work for me. could please put it in my code a bove and post the code here again.

thanks for helping.

Regards

0

After

$result = mysql_query("SELECT * FROM clients WHERE clientID=$_POST[bookingID]");

Use

if(mysql_num_rows($result) > 0 ) {
// record exists.. Do whatever you want to do with that record
} else {
echo "<a href='backpage.php'>Click here to go back and change your booking id.. </a>";
}
0

how i retrieve data from in the same raw but in different column

name category supplier_id item_number description
computer laptop uonp 4577y99 uiuhjhjhj

i select name through drop down this is work but the problem is how i retrieve item_number automatically in text box when i select name in php

0

how i retrieve data from in the same raw but in different column

name category supplier_id item_number description
computer laptop uonp 4577y99 uiuhjhjhj

i select name through drop down this is work but the problem is how i retrieve item_number automatically in text box when i select name in php

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.