Jump to content

Please help!!


tourer

Recommended Posts

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";
  }
  }
?>

Link to comment
https://forums.phpfreaks.com/topic/182995-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.