Jump to content

Recommended Posts

Hey i have a couple of syntax errors that i do with help with please.

 

Making A Booking

 

# connect to MySQL
$conn = @mysql_connect("localhost","ajdref","ref2")
or die ("sorry - could not connect to MySQL"); 

# select the specified database
$rs = @mysql_select_db("ajdref", $conn)
or die ("sorry - could not connect to the ajdref");

#create the query - sets $sql to contain the required query
$sql = "SELECT * FROM `Member Booking Database`"; 

$sql = "INSERT INTO `Member Booking Database` (`Check In`, `Check Out`, `Price Cat`, `Type Of Room`) VALUES ('$CheckIn', '$CheckOut', '$Price_Cat', '$Type_Of_Room')";

mysql_query($sql,$conn)or die(mysql_error());

if($rs){ echo("Booking added");}
else { echo("Error! Booking not added");}

 

Searching A Booking

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<?php

# connect to MySQL
$conn = @mysql_connect("localhost","ajdref","ref2")
or die ("sorry - could not connect to MySQL"); 

# select the specified database
$rs = @mysql_select_db("ajdref", $conn)
or die ("sorry - could not connect to the ajdref");

$sql = "SELECT * FROM `Booking Database` WHERE Customer_Username='$Customer_Username'";
$result = mysql_query($sql)or die(mysql_error());

?>
<body>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/66402-syntax-errors/
Share on other sites

well basically what im trying to do is this:

 

the work is build a hotel database (done that) and part of it is so that customers can search for a booking that they have made.

 

Im trying to do that bit but im really struggling, im not even sure if i can use the 'Where' Clause in this particular bit.

Link to comment
https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332364
Share on other sites

I fixed one of the syntax errors. Im asking if its possible that a customer can search a booking that they have previously booked. (so they amend/cancel it.) Is it possible? if so, what is the coding for it, because im stuck on it..

 

Here is the NEW coding that I have amended myself, so ignore the earlier code posts.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<?php

# connect to MySQL
$conn = @mysql_connect("localhost","ajdref","ref2")
or die ("sorry - could not connect to MySQL"); 

# select the specified database
$rs = @mysql_select_db("ajdref", $conn)
or die ("sorry - could not connect to the ajdref");

$sql = "SELECT * FROM `Member Booking Database` WHERE Customer Username='$CustomerUsername'";
$result = mysql_query($sql)or die(mysql_error());

?>
<body>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332369
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.