...

View Full Version : problem with code - beginner need help



Gez
05-13-2008, 11:10 PM
I'm quite new to coding and tbh am quite terrible at it and i have a coursework deadline in afew weeks and ive got aot more to do some any help on the errors i will greatly appreciate. The error im getting at the mo is "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /disks/diskh/zco/cogf/public_html/Planner/flightfinder.php on line 15" any ideas?



Gez




<?php

session_start();

Include ("dbconnect.php");



Function ShowRetFlights (){

// Set Sessions

$DestinationName=$_SESSION['destination'];

$FlyingFrom=$_SESSION['flyfrom'];

$RetDate=$_SESSION['retdate'];

// Do the query

$resultret = mysql_query("SELECT * FROM $table_flight

WHERE DestinationAirport ='".$FlyingFrom."'

AND DepartureDate ='".$RetDate"'

AND DepartureAirport ='"$DestinationName"'");



return ($resultrep);



echo " <b> INBOUND flights </b> <br/><br/>

<table width="200" border="0">

<tr>

<td>Destination: </td>

<td>Airline:</td>

<td>Departure Airport:</td>

<td>Departure Date:</td>

<td>Departure Time:</td>

<td>Cost:</td>

<td></td>

</tr>";



// Display the results

while ($row = mysql_fetch_array( $resultdep )){

echo "<tr>";

echo " <td>".$row['DestinationAirport']."</td>";

echo " <td>".$row['Airline']."</td>";

echo " <td>".$row['DepartureAirport']."</td>";

echo " <td>".$row['DepartureDate']."</td>";

echo " <td>".$row['DepartureTime']."</td>";

echo " <td>".$row['Fare']."</td>";

echo " <td></td>";

echo " </tr>";

}

echo "</table><br/><hr><br>/";

}





Function ShowDepFlights (){

$table_flight="flight";

// Set Sessions

$DestinationName=$_SESSION['destination'];

$DepDate=$_SESSION['depdate'];

$FlyingFrom=$_SESSION['flyfrom'];

$RetDate=$_SESSION['fretdate'];



// Do the query

$resultdep = mysql_query("SELECT * FROM $table_flight

WHERE DestinationAirport ='".$DestinationName."'

AND DepartureDate ='".$DepDate."'

AND DepartureAirport ='".$FlyingFrom."'");

return ($resultdep);



echo " <b> OUTBOUND flights </b> <br/><br/>

<table width="200" border="0">

<tr>

<td>Destination: </td>

<td>Airline:</td>

<td>Departure Airport:</td>

<td>Departure Date:</td>

<td>Departure Time:</td>

<td>Cost:</td>

<td></td>

</tr>";



// Display the results

while ($row = mysql_fetch_array( $resultdep )){

echo "<tr>";

echo " <td>".$row['DestinationAirport']."</td>";

echo " <td>".$row['Airline']."</td>";

echo " <td>".$row['DepartureAirport']."</td>";

echo " <td>".$row['DepartureDate']."</td>";

echo " <td>".$row['DepartureTime']."</td>";

echo " <td>".$row['Fare']."</td>";

echo " <td></td>";

echo " </tr>";

}

echo "</table><br/><hr><br>/";

}





echo "

<html>

<head>

<title> Lufbra Travel </title>

</head>

<body bgcolor='0066FF' fontcolor='0066FF' >

<h1><align ='center'>Lufbra Travel</align></h1> ";



echo "

<form action='".$_SERVER['PHP_SELF']."' method='GET'>

<table align='center' width='200' border='0'>

<tr>

<td>Destination:</td>

<td>Flying from:</td>

</tr>

<tr>

<td><input name='destination' type='text'></td>

<td><input name='flyfrom' type='text'></td>

</tr>

<tr>

<td>Date (YYY-MM-DD)</td>

<td>Date (YYY-MM-DD)</td>

</tr>

<tr>

<td><input name='depdate' type='text'></td>

<td><input name='retdate' type='text'></td>

</tr>

<tr>

<td><input type='submit' value='Take me there!'></td>

</tr>

</table>

</form>";

DepFlights();



RetFlights();



echo "

</body>

</html> ";

?>

oesxyl
05-13-2008, 11:41 PM
I'm quite new to coding and tbh am quite terrible at it and i have a coursework deadline in afew weeks and ive got aot more to do some any help on the errors i will greatly appreciate. The error im getting at the mo is "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /disks/diskh/zco/cogf/public_html/Planner/flightfinder.php on line 15" any ideas?

Gez
it's more easy to you to find the error because:
- it say very clear on line 15, and I don't know or I'm not sure, after you post, where is this line, :)
- the message is clear: T_CONSTANT_ENCAPSED_STRING
- you use quote instead of php or code tags, :)



$resultret = mysql_query("SELECT * FROM $table_flight
WHERE DestinationAirport ='".$FlyingFrom."'
AND DepartureDate ='".$RetDate."'
AND DepartureAirport ='".$DestinationName."'");
I guess that are three missing dots, just a typo, :)

regards

Gez
05-13-2008, 11:48 PM
awww thank you so much!! such an ovious mistake can't believe i didn't spot that :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum