adamdyer Posted August 23, 2007 Share Posted August 23, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/ Share on other sites More sharing options...
lemmin Posted August 23, 2007 Share Posted August 23, 2007 PHP or MySQL syntax? Could you post what the error says? Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332348 Share on other sites More sharing options...
nathanmaxsonadil Posted August 23, 2007 Share Posted August 23, 2007 we wont be able to help you if we don't know the error Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332352 Share on other sites More sharing options...
adamdyer Posted August 23, 2007 Author Share Posted August 23, 2007 sorry it took so long to reply the error reads : Unknown column 'Customer_Username' in 'where clause' EDIT - i sorted the 'Making A Booking' - so its just the Searching A Booking one that ive having a problem with now. Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332356 Share on other sites More sharing options...
nathanmaxsonadil Posted August 23, 2007 Share Posted August 23, 2007 that's becuase there's no Customer_Username Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332358 Share on other sites More sharing options...
adamdyer Posted August 23, 2007 Author Share Posted August 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332364 Share on other sites More sharing options...
lemmin Posted August 23, 2007 Share Posted August 23, 2007 What are you asking? Did you fix the syntax errors? Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332367 Share on other sites More sharing options...
adamdyer Posted August 23, 2007 Author Share Posted August 23, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/66402-syntax-errors/#findComment-332369 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.