Jump to content

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.