Hi people im making an online booking system as a final year project in
my university i get this error which i cannot seem to fix !
Here is my code:
PART 1 *************** *************** *************** ************
#connect to sql
$connect=@mysql _connect("local host","root","" )
or die("Err:Conn") ;
#database select
$database=@mysq l_select_db("ti mes",$connect)
or die("Err:Db");
#create query
//$sql = 'SELECT * FROM `show` ';
$sql = "SELECT * FROM show WHERE from = '$from' AND to = '$to' ";
#execute
$query= @mysql_query($s ql,$database) or die('Error ' . mysql_error() .
' in ' . $sql);
PART 2 *************** *************** *************** ************
while ($row = mysql_fetch_arr ay($query))
{
$return="<font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"showall. php\">Select a RETURN travel </a><b><font
color=\"#FF0000 \"><<</font></b><br>";
$homepage="<fon t color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"index.ph p\">Choose a route </a><b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$changetravel=" <font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"bookexpi re.php\">CHANGE your travel</a> <b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$checkout="<fon t color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"book3.ph p\">CHECKOUT & PAYMENT</a> <b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$oneway="<font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"showall. php\">Select a 1-WAY travel </a><b><font
color=\"#FF0000 \"><<</font></b><br>";
?>
<br>
<br>
<div align="center">
<table border="1" bordercolordark ="#FF0000" cellspacing="0"
cellpadding="0" bordercolorligh t="#FF0000" width="731">
<tr>
<td align="center"> <font
color="#FF0000" ><u><b>TICKET TYPE</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>FROM</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>TO</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>PRICE</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>TIME</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>DATE</b></u></font></td>
</tr>
<tr>
<td align="center"> <?php echo $row["type"];
?></td>
<td align="center"> <?php echo $row["from"];
?></td>
<td align="center"> <?php echo $row["to"];
?></td>
<td align="center"> <?php echo $row["price"]; ?>
GBP</td>
<td align="center"> <?php echo $row["time"];
?></td>
<td align="center"> <?php echo $row["date"];
?></td>
</tr>
</table>
<table border="1" width="435" bordercolordark ="#FFFF00"
bordercolorligh t="#FFFF00" cellspacing="0" cellpadding="0" >
<tr>
*************** *************** *************** ************
So whats wrong in my code ? This error only occurs when i want to
select specific values form the database from a form (the $from,$to)
values if i change my query to display ALL THE RESULTS using
$sql = 'SELECT * FROM `show` ';
itworks perfectly with no errors
please help me !!
cheers
my university i get this error which i cannot seem to fix !
Here is my code:
PART 1 *************** *************** *************** ************
#connect to sql
$connect=@mysql _connect("local host","root","" )
or die("Err:Conn") ;
#database select
$database=@mysq l_select_db("ti mes",$connect)
or die("Err:Db");
#create query
//$sql = 'SELECT * FROM `show` ';
$sql = "SELECT * FROM show WHERE from = '$from' AND to = '$to' ";
#execute
$query= @mysql_query($s ql,$database) or die('Error ' . mysql_error() .
' in ' . $sql);
PART 2 *************** *************** *************** ************
while ($row = mysql_fetch_arr ay($query))
{
$return="<font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"showall. php\">Select a RETURN travel </a><b><font
color=\"#FF0000 \"><<</font></b><br>";
$homepage="<fon t color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"index.ph p\">Choose a route </a><b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$changetravel=" <font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"bookexpi re.php\">CHANGE your travel</a> <b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$checkout="<fon t color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"book3.ph p\">CHECKOUT & PAYMENT</a> <b><font
color=\"#FF0000 \"><<</font></b><br><br>";
$oneway="<font color=\"#FF0000 \"><b>>&g t;</b></font> <a
href=\"showall. php\">Select a 1-WAY travel </a><b><font
color=\"#FF0000 \"><<</font></b><br>";
?>
<br>
<br>
<div align="center">
<table border="1" bordercolordark ="#FF0000" cellspacing="0"
cellpadding="0" bordercolorligh t="#FF0000" width="731">
<tr>
<td align="center"> <font
color="#FF0000" ><u><b>TICKET TYPE</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>FROM</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>TO</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>PRICE</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>TIME</b></u></font></td>
<td align="center"> <font
color="#FF0000" ><u><b>DATE</b></u></font></td>
</tr>
<tr>
<td align="center"> <?php echo $row["type"];
?></td>
<td align="center"> <?php echo $row["from"];
?></td>
<td align="center"> <?php echo $row["to"];
?></td>
<td align="center"> <?php echo $row["price"]; ?>
GBP</td>
<td align="center"> <?php echo $row["time"];
?></td>
<td align="center"> <?php echo $row["date"];
?></td>
</tr>
</table>
<table border="1" width="435" bordercolordark ="#FFFF00"
bordercolorligh t="#FFFF00" cellspacing="0" cellpadding="0" >
<tr>
*************** *************** *************** ************
So whats wrong in my code ? This error only occurs when i want to
select specific values form the database from a form (the $from,$to)
values if i change my query to display ALL THE RESULTS using
$sql = 'SELECT * FROM `show` ';
itworks perfectly with no errors
please help me !!
cheers
Comment