uniboy86 Posted February 12, 2008 Share Posted February 12, 2008 Hello I have this script here which is activated when I click on the submit button it gets the value from the text box as it comes up in the error when I click the submit button. <?php session_start(); if(isset($_SESSION['username']) == false){ header("Location: login.php"); exit(); } $roomno = $_GET['roomno']; require "connect.php"; if (isset($_GET['search'])){ $query = "select * from booking, student, room where booking.RoomNo = room.RoomNo and booking.StudentId = student.StudentId and RoomNo='".$roomno."'"; $result = mysql_query($query, $connection) or die("Unable to execute query<br>$query"); } ?> I get this error when i click submit: Unable to execute query select * from booking, student, room where booking.RoomNo = room.RoomNo and booking.StudentId = student.StudentId and RoomNo='1' So it is getting the value from the input box but I can't get it to display the data. I think it is a syntax error but I have been trying to work it out for ages but it is really bugging me now Can someone please help asap as I have a tight deadline or anywhere you can direct me that might help Thanks in advance Chris Quote Link to comment https://forums.phpfreaks.com/topic/90725-search-a-mysql-database-using-a-php-script-and-a-value-from-text-box/ 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.