0

hi, i'm back again to ask few question i have a problem on my online reservation system.

here's my code

<?php

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

mysql_select_db("reservation", $con);

$rno = $_POST['rno'];
$in = $_POST['ADate'];
$out = $_POST['AnotherDate'];
$nor = $_POST['noofrooms'];
$rtype = $_POST['roomtype'];
$id = $_POST['cno'];


$search="Select checkout from rent where roomno='$rno'";
$result1=mysql_query($search);

if($in == '$result1')
{
echo "Room Number already in use.";
}
else
{
$sql="UPDATE rent SET roomno ='$rno', checkin = '$in', checkout = '$out', noofrooms = '$nor', roomtype = '$rtype' WHERE cno='$id'";


$result=mysql_query($sql);

echo "Update Successfull";
}
?>

my problem is how can i determine that the roomno is already in use with this date

for example i have 1 client already stored on my database and he will be check out in 02/21/2010 at room 1, if the admin will assign roomno 1 to the other client and if the checkin is equivalent to the checkout of 1 client i want to put an error "Room Number is Already in Use" else if not it will update my database.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ryan311
This topic has been dead for over six months. 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.