Jump to content

Search a mysql database using a php script and a value from text box


uniboy86

Recommended Posts

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.