I have this error message --> Warning: mysql_fetch_arr ay() expects parameter 1 to be resource, boolean given in C:\wamp\www\scr ipt.php on line 24
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'date']; ?>','3:00am')' at line 1
The one that i bold and underline is Line 24
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'date']; ?>','3:00am')' at line 1
The one that i bold and underline is Line 24
Code:
<?php
session_start();
$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "futsal";
$tblname = "booking";
$connection = mysql_connect($hostname, $username, $password) or die(mysql_error());
$db = mysql_select_db($dbname, $connection) or die (mysql_error());
$username = $_SESSION['username'];
$courts = $_POST['courts'];
$date = $_POST['date'];
$time = $_POST['time'];
$result_user_id = mysql_query("select user_id FROM user WHERE username = '$username'");
if($row = mysql_fetch_array($result_user_id)){
$user_id = $row['user_id'];
}
$resultz = mysql_query("select * FROM booking WHERE date = '$date' AND time = '$time' AND courts = '$courts' ");echo $resultz;
[B][I]line 24-> [/I][/B] [I][U][B]if($row = mysql_fetch_array($resultz)){[/B][/U][/I]
echo "<table width='100%'><td height='50' align='center' bgcolor='#85A157'><font size='4'><strong>The court are not available</strong></font></td></table>";
echo "<meta http-equiv='refresh' content='1;url=booking.php'>";
}
else
{
$sql = "INSERT INTO booking(user_id,username,courts,date,time) VALUE ('$user_id','$username','$courts','$date','$time')";
$result = mysql_query($sql) or die (mysql_error());
$_SESSION['courts'] = $courts;
$_SESSION['date'] = $date;
$_SESSION['time'] = $time;
//echo "<meta http-equiv='refresh' content='10;url=booking_success.php'>"
echo "<table width='100%'><td height='50' align='center' bgcolor='#85A157'><font size='4'><strong>PROCESS BOOKING</strong></font></td></table>";
echo "<table width='1000'><td align='center'><img src='image futsal/loading3.gif'></td></table>";
echo "<meta http-equiv='refresh' content='1;url=booking_success.php'>";
}
?>
Comment