Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Gez
    Gez is offline
    New Coder
    Join Date
    May 2008
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    problem with code - beginner need help

    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> ";

    ?>

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Gez View Post
    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,

    Code:
    $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

  • #3
    Gez
    Gez is offline
    New Coder
    Join Date
    May 2008
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts
    awww thank you so much!! such an ovious mistake can't believe i didn't spot that


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •