Sparrow Posted September 27, 2008 Share Posted September 27, 2008 I'm getting a $end error when I run the code bellow. The error says: Parse error: syntax error, unexpected $end in /home/unitedai/public_html/pirep_process.php on line 103 (Line 103 is the last line). Whats wrong: <?php session_start(); include 'session_checker30.php'; session_checker(); include 'db.php'; $username = $_POST['username']; $date = $_POST['date']; $icao_orig = $_POST['icao_orig']; $icao_dest = $_POST['icao_dest']; $aircraft = $_POST['aircraft']; $route_number = $_POST['route_number']; $dep_time = $_POST['dep_time']; $flthrs2 = $_POST['flthrs2']; $comments = $_POST['comments']; $username = stripslashes($username); $date = stripslashes($date); $icao_orig = stripslashes($icao_orig); $icao_dest = stripslashes($icao_dest); $aircraft = stripslashes($aircraft); $route_number = stripslashes($route_number); $dep_time = stripslashes($dep_time); $flthrs2 = stripslashes($flthrs2); $comments = stripslashes($comments); //check for empty fields if((!$date) || (!$icao_orig) || (!$icao_dest) || (!$route_number) || (!$dep_time) || (!$flthrs2)){ echo 'You did not submit a complete pirep! Please be sure all fields are completed. <br />'; // Show the form again! include 'pireps.php'; exit(); //Double flight time if an event if ($routenum == 'EVT'){ $flthrs2 = $_POST['flthrs2'] * 2; } else {$flthrs2 == $_POST['flthrs2']; } //insert info into pirep table $comments2 = htmlspecialchars($comments); $sql = mysql_query ("INSERT INTO pirep (date, username, icao_orig, icao_dest, aircraft, route_number, dep_time, flthrs2, last_pirep, comments) VALUES('$date','{$_SESSION['username']}','$icao_orig','$icao_dest','$aircraft','$route_number','$dep_time','$flthrs2','now()','$comments')") or die (mysql_error()); if(!$sql){ echo 'There has been an error processing your pirep. Please contact the webmaster.'; } $sql = "SELECT * FROM users WHERE username = '{$_SESSION['username']}'"; $result = mysql_query($sql); $user_array = mysql_fetch_array($result); //add time to flight hours $flthrs = $user_array['flthrs']; $newflthrs = $flthrs + $flthrs2; mysql_query("UPDATE users SET flthrs = '$newflthrs' WHERE username = '{$_SESSION['username']}'"); //Get info from booked_flights $sql = "SELECT * FROM booked_flights WHERE route_number = '$route_number'"; $result = mysql_query($sql) or die(mysql_error()); $array = mysql_fetch_array($result) or die(mysql_error()); //Turn into variables $type = $array['type']; $dep_airport = $array['dep_airport']; $arr_airport = $array['arr_airport']; $aircraft = $array['aircraft']; $Rank = $array['Rank']; $dep_day = $array['dep_day']; $duration = $array['duration']; $route_number = $array['route_number']; $username = $array['username']; // Enter info into flights. $info2 = htmlspecialchars($info); $sql = mysql_query("INSERT INTO flights (type, dep_airport, arr_airport, aircraft, Rank, dep_day, duration, route_number) VALUES('$type', '$dep_airport', '$arr_airport', '$aircraft', '$Rank', '$dep_day', '$duration', '$route_number')") or die (mysql_error()); if(!$sql){ echo 'There has been an error in filing your flight. Please try again.'; } //Delete info from booked_flights to prevent problems. mysql_query("DELETE FROM booked_flights WHERE route_number = '$route_number'"); mysql_close($connection); //show user decision page include 'pirep_filed.php'; ?> Quote Link to comment Share on other sites More sharing options...
peranha Posted September 27, 2008 Share Posted September 27, 2008 This if statement was never closed. //check for empty fields if((!$date) || (!$icao_orig) || (!$icao_dest) || (!$route_number) || (!$dep_time) || (!$flthrs2)){ echo 'You did not submit a complete pirep! Please be sure all fields are completed. <br />'; You are missing the closing } Quote Link to comment 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.