tourer Posted November 26, 2009 Share Posted November 26, 2009 Here the user is entering some unique reservation id which is matched with the same userid stored in the database. Also i select the start date, start time & end time of the slot booked by the user whose values are already stored in the Mysql database. The functionality i require here is to check the reservation id first. Then the start date has to be checked with the current date in the server. Then the following code to be inserted somewhere: if {(servertime=>starttime)&&(servertime<endtime)] { allow the user to go to (www.localhost/XXX.html); if (server=endtime) {close the page} } else echo "It is not your time". Below is the code which i have written so far. I am no gud in php & Mysql. Just in case anyone can help. <?php $dbhost = 'localhost'; $dbuser = 'XXX'; $dbpass = 'XXXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); if (isset($_POST['resid1']) ) { $userId = $_POST['resid1']; $sql = "SELECT resid,start_date,starttime,endtime FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { echo "Yah It is Your Time "; } else { echo "Sorry, wrong user resid"; } } ?> Quote Link to comment Share on other sites More sharing options...
fenway Posted November 26, 2009 Share Posted November 26, 2009 And what's wrong? Other than a poor choice for a title? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.