I'm making a restaurant reservation module using PHP.
The problem is that I would like to make the user choose which time they would like to come and which time the would like to go.
Between these two times the table needs to be occupied, so there needs to be a name in that cell between those times.
I have no idea how to get this done.
Here is my existing code:
$day="0".$_POST['day'];
$month="0".$_POST['month'];
$year=$_POST['year'];
$date=$year ."-". $month ."-". $day;
$table=$_POST['table'];
$name=$_POST['name'];
$fromtime=$_POST['fromtime'];
$untiltime=$_POST['untiltime'];
$tablenumber = $table;
$host="localhost";
$user="root";
$password="root";
$database="restaurant";
$connection = mysql_connect ($host, $user, $password)
or die ("could not connect with server");
$db = mysql_select_db ($database, $connection)
or die ("could not connect with db");
$query = mysql_query("SELECT * FROM tables WHERE table='$tablenumber' AND date = '$date'");
?>
tablestable? By the way, if possible, stop usingmysql_php.net/manual/en/intro.mysql.phpmysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.