Jump to content

Recommended Posts

<?php
if(!logged_in){
						echo 'You cannot access this page as you are not logged in.';
						}else{
						$pid = $_SESSION['username'];
						$bidcheckprevsql = mysql_query("SELECT * FROM flightbids WHERE pid = '{$pid}'");
						$bidcheck = mysql_num_rows($bidcheckprevsql);
						if($bidcheck!=0){
						echo 'You cannot bid another flight as you have one already bid. Please file it or delete it.';
						$bidcheck = '';
						$bidcheckprevsql = '';
						}else{
						echo $bidcheck;
						$bidcheck = '';
						$bidcheckprevsql = '';
						echo $bidcheck;
						if(isset($_POST['bid_flight'])){
						$pid = $_SESSION['username'];

						$dept = $_POST['dept'];
						$dest = $_POST['dest'];
						$fltnum = $_POST['fltnum'];
						$aircraft = $_POST['aircraft'];
						$username = $_SESSION['username'];
						$rank = $_SESSION['rank'];
						$name = $_SESSION['name'];
						$route = $_POST['route'];
						$tail = $_POST['tail'];
						$detailedroute = $_POST['detailedroute'];
						mysql_query("INSERT INTO `zoomdb`.`flightbids` (`dept` ,`dest` ,`flight_id` ,`route` ,`aircraft`, `pid` ,`rank` ,`name` ,`date` ,`time`, `reg`)VALUES ('{$dept}', '{$dest}', '{$fltnum}', '{$route}', '{$aircraft}','{$username}', '{$rank}', '{$name}' ,CURDATE( ) ,CURRENT_TIMESTAMP, $tail )");
						$my_t=getdate(date("U"));
						$textbr = $_SESSION["username"].' '.$_POST['dept'].'/'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes].'<br />FP '.$_POST['fltnum'].' '.$_POST['aircraft'].' '.$_POST['acftreg'].' '.$_SESSION['rank'].' '.$_SESSION['name'].'<br /><br />RMKS<br />'.$rmks.'<br /><br />'.$route.'<br /><br />'.$detailedroute.'<br /><br />METARS<br />Departure<br />Not Available<br /><br />Dest<br />Not Available';
$text = $_SESSION["username"].' '.$_POST['dept'].'/'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes].'
FP '.$_POST['fltnum'].' '.$_POST['aircraft'].' '.$_POST['acftreg'].' '.$_SESSION['rank'].' '.$_SESSION['name'].'

RMKS
'.$rmks.'

'.$route.'

'.$detailedroute.'

METARS
Departure
Not Available

Dest
Not Available';
						echo '<span class="fpln">';
						echo $textbr;
						echo '<br />';
						echo '</span>';

$filename = 'OOM'.$_SESSION["username"].'_'.$_POST['dept'].'-'.$_POST['dest'].'_'.$my_t[mday].' '.$my_t[month].' '.$my_t[year].'_'.$my_t[hours].''.$my_t[minutes].' '.$my_t[minutes].'.txt';
$file = fopen("../ops/fplns/".$filename,"w");
fwrite($file,$text);
fclose($file);
echo '<br /><a href="fplns/'.$filename.'" target="_blank">Download Flight Plan</a>';
						}else{
						$fltnum = $_GET['f'];
						$book_data_sql = mysql_query("select * from flights WHERE flight_num = '{$fltnum}'");
						while($book_data = mysql_fetch_array($book_data_sql)){
						$dept = $book_data['depticao'];
						$dest = $book_data['desticao'];
						$aircraft = $book_data['aircraft'];
						$route = $book_data['route'];
						$detailedroute = $book_data['detailed_route'];
						}
						$regrand = rand(1,5);
						?>
<a href="flights.php?p=board">Click Here for Flight Schedule </a></p>
        <p> </p>
        <form action="flights.php?p=book" method="POST">
          
	  <table width="312" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>Flight Number </td>
              <td><input name="fltnum" type="text" id="fltnum" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $_GET['f']; ?>" /></td>
            </tr>
            <tr>
              <td width="69%"><label for="dept">Departure (ICAO)</label></td>
              <td width="31%"><input name="dept" type="text" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $dept; ?>" maxlength="4" /></td>
            </tr>
            <tr>
              <td>Destination (ICAO </td>
              <td><input name="dest" type="text" id="dest" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $dest; ?>" maxlength="4" /></td>
            </tr>
            <tr>
              <td>Aircraft</td>
              <td>
		  <?php
		  if(!isset($aircraft)){ ?>
		  <select name="aircraft">
                  <option value="0" selected="selected">Select One</option>
                  <option value="763">767-300</option>
                  <option value="752">757-200</option>
                  <option value="320">A320</option>
                </select>
			<?php }else{ 
			echo '<input name="aircraft_disabled" value="'.$aircraft.'" disabled type="text">';
			echo '<input name="aircraft" value="'.$aircraft.'" type="hidden">';
			} ?>              </td>
            </tr>
            <tr>
              <td>Aircraft Registration </td>
              <td><?php
		  if(!isset($_GET['f'])){
		  ?>
		  <select name="tail" id="tail">
                <option value="0" selected="selected">--Select--</option>
                <option value="0"> </option>
                <option value="0">----767----</option>
                <option value="C-GZUM">C-GZUM</option>
                <option value="C-GZMM">C-GZMM</option>
                <option value="C-GZNA">C-GZNA</option>
                <option value="C-GZNC">C-GZNC</option>
                <option value="G-UKZM">G-UKZM</option>
                <option value="0"> </option>
                <option value="0">----757----</option>
                <option value="C-GTSN">C-GTSN</option>
                <option value="0"> </option>
                <option value="0">---A320---</option>
                <option value="C-GZUM">C-GZUM</option>
              </select>
		  <?php
		  }else{
		  if($aircraft == '763'){
		  if($regrand == 1){
		  echo '<input disabled name="reg" value="C-GZUM" type="text" />';
		  echo '<input name="acftreg" value="C-GZUM" type="hidden" />';
		  }elseif($regrand == 2){
		  echo '<input disabled name="reg" value="C-GZMM" type="text" />';
		  echo '<input name="acftreg" value="C-GZMM" type="hidden" />';
		  }elseif($regrand == 3){
		  echo '<input disabled name="reg" value="C-GZNA" type="text" />';
		  echo '<input name="acftreg" value="C-GZNA" type="hidden" />';
		  }elseif($regrand == 4){
		  echo '<input disabled name="reg" value="C-GZNC" type="text" />';
		  echo '<input name="acftreg" value="C-GZNC" type="hidden" />';
		  }elseif($regrand == 5){
		  echo '<input disabled name="reg" value="G-UKZM" type="text" />';
		  echo '<input name="acftreg" value="G-UKZM" type="hidden" />';
		  }
		  }elseif($aircraft == '752'){
		  echo '<input disabled name="reg" value="C-GTSN" type="text" />';
		  echo '<input name="acftreg" value="C-GTSN" type="hidden" />';
		  }elseif($aircraft == '320'){
		  echo '<input disabled name="reg" value="C-GZUM" type="text" />';
		  echo '<input name="acftreg" value="C-GZUM" type="hidden" />';
		  }else{
		  ?>
		  <select name="tail" id="tail">
                <option value="0" selected="selected">--Select--</option>
                <option value="0"> </option>
                <option value="0">----767----</option>
                <option value="C-GZUM">C-GZUM</option>
                <option value="C-GZMM">C-GZMM</option>
                <option value="C-GZNA">C-GZNA</option>
                <option value="C-GZNC">C-GZNC</option>
                <option value="G-UKZM">G-UKZM</option>
                <option value="0"> </option>
                <option value="0">----757----</option>
                <option value="C-GTSN">C-GTSN</option>
                <option value="0"> </option>
                <option value="0">---A320---</option>
                <option value="C-GZUM">C-GZUM</option>
              </select>
		  <?php
		  }
		  }
		  ?>			  </td>
            </tr>
            <tr>
              <td colspan="2">
		  <?php
		  $book_data_sql = mysql_query("select * from flights WHERE flight_num = '{$fltnum}'");
						while($book_data = mysql_fetch_array($book_data_sql)){
		  if(empty($book_data['route'])){
                echo '<textarea name="route" rows="5" id="route" style="background:url(../images/route_bkg.jpg) no-repeat; width:100%"></textarea>';
			}else{
			echo '<input name="detailedroute" type="hidden" value="'.$detailedroute.'" />';
			echo '<textarea disabled name="route_disabled" rows="5" id="route" style="width:100%">'.$route.'</textarea>';
			echo '<input name="route" type="hidden" value="'.$route.'" />';
			}}
		  ?>			  </td>
            </tr>
            <tr>
              <td colspan="2"><label>
                <input type="submit" style="width:100%;" class="status_inputs status_blue" name="bid_flight" value="Bid Flight" />
              </label></td>
            </tr>
          </table>
        </form>
        <?php
						}}}

?>

 

Do you see anything wrong with this? When ever the textarea Route isset, it doesn't upload to the database. It gives no error. It worked before, but I do not know what happened.

Link to comment
https://forums.phpfreaks.com/topic/85123-solved-mysql-error/
Share on other sites

<?php
if(!logged_in){
						echo 'You cannot access this page as you are not logged in.';
						}else{
						$pid = $_SESSION['username'];
						$bidcheckprevsql = mysql_query("SELECT * FROM flightbids WHERE pid = '$pid'");
						$bidcheck = mysql_num_rows($bidcheckprevsql);
						if($bidcheck!=0){
						echo 'You cannot bid another flight as you have one already bid. Please file it or delete it.';
						$bidcheck = '';
						$bidcheckprevsql = '';
						}else{
						echo $bidcheck;
						$bidcheck = '';
						$bidcheckprevsql = '';
						echo $bidcheck;
						if(isset($_POST['bid_flight'])){
						$pid = $_SESSION['username'];

						$dept = $_POST['dept'];
						$dest = $_POST['dest'];
						$fltnum = $_POST['fltnum'];
						$aircraft = $_POST['aircraft'];
						$username = $_SESSION['username'];
						$rank = $_SESSION['rank'];
						$name = $_SESSION['name'];
						$route = $_POST['route'];
						$tail = $_POST['tail'];
						$detailedroute = $_POST['detailedroute'];
						mysql_query("INSERT INTO `zoomdb`.`flightbids` (`dept` ,`dest` ,`flight_id` ,`route` ,`aircraft`, `pid` ,`rank` ,`name` ,`date` ,`time`, `reg`)VALUES ('{$dept}', '{$dest}', '{$fltnum}', '{$route}', '{$aircraft}','{$username}', '{$rank}', '{$name}' ,CURDATE( ) ,CURRENT_TIMESTAMP, $tail )") or die(mysql_error());
						$my_t=getdate(date("U"));
						$textbr = $_SESSION["username"].' '.$_POST['dept'].'/'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes].'<br />FP '.$_POST['fltnum'].' '.$_POST['aircraft'].' '.$_POST['acftreg'].' '.$_SESSION['rank'].' '.$_SESSION['name'].'<br /><br />RMKS<br />'.$rmks.'<br /><br />'.$route.'<br /><br />'.$detailedroute.'<br /><br />METARS<br />Departure<br />Not Available<br /><br />Dest<br />Not Available';
$text = $_SESSION["username"].' '.$_POST['dept'].'/'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes].'
FP '.$_POST['fltnum'].' '.$_POST['aircraft'].' '.$_POST['acftreg'].' '.$_SESSION['rank'].' '.$_SESSION['name'].'

RMKS
'.$rmks.'

'.$route.'

'.$detailedroute.'

METARS
Departure
Not Available

Dest
Not Available';
						echo '<span class="fpln">';
						echo $textbr;
						echo '<br />';
						echo '</span>';

$filename = 'OOM'.$_SESSION["username"].'_'.$_POST['dept'].'-'.$_POST['dest'].'_'.$my_t[mday].' '.$my_t[month].' '.$my_t[year].'_'.$my_t[hours].''.$my_t[minutes].' '.$my_t[minutes].'.txt';
$file = fopen("../ops/fplns/".$filename,"w");
fwrite($file,$text);
fclose($file);
echo '<br /><a href="fplns/'.$filename.'" target="_blank">Download Flight Plan</a>';
						}else{
						$fltnum = $_GET['f'];
						$book_data_sql = mysql_query("select * from flights WHERE flight_num = '{$fltnum}'");
						while($book_data = mysql_fetch_array($book_data_sql)){
						$dept = $book_data['depticao'];
						$dest = $book_data['desticao'];
						$aircraft = $book_data['aircraft'];
						$route = $book_data['route'];
						$detailedroute = $book_data['detailed_route'];
						}
						$regrand = rand(1,5);
						?>
<a href="flights.php?p=board">Click Here for Flight Schedule </a></p>
        <p> </p>
        <form action="flights.php?p=book" method="POST">
          
	  <table width="312" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>Flight Number </td>
              <td><input name="fltnum" type="text" id="fltnum" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $_GET['f']; ?>" /></td>
            </tr>
            <tr>
              <td width="69%"><label for="dept">Departure (ICAO)</label></td>
              <td width="31%"><input name="dept" type="text" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $dept; ?>" maxlength="4" /></td>
            </tr>
            <tr>
              <td>Destination (ICAO </td>
              <td><input name="dest" type="text" id="dest" style="background:#FFFFFF" onfocus="this.style.background='#F0F7FF'" onblur="this.style.background='#ffffff'" value="<?php echo $dest; ?>" maxlength="4" /></td>
            </tr>
            <tr>
              <td>Aircraft</td>
              <td>
		  <?php
		  if(!isset($aircraft)){ ?>
		  <select name="aircraft">
                  <option value="0" selected="selected">Select One</option>
                  <option value="763">767-300</option>
                  <option value="752">757-200</option>
                  <option value="320">A320</option>
                </select>
			<?php }else{ 
			echo '<input name="aircraft_disabled" value="'.$aircraft.'" disabled type="text">';
			echo '<input name="aircraft" value="'.$aircraft.'" type="hidden">';
			} ?>              </td>
            </tr>
            <tr>
              <td>Aircraft Registration </td>
              <td><?php
		  if(!isset($_GET['f'])){
		  ?>
		  <select name="tail" id="tail">
                <option value="0" selected="selected">--Select--</option>
                <option value="0"> </option>
                <option value="0">----767----</option>
                <option value="C-GZUM">C-GZUM</option>
                <option value="C-GZMM">C-GZMM</option>
                <option value="C-GZNA">C-GZNA</option>
                <option value="C-GZNC">C-GZNC</option>
                <option value="G-UKZM">G-UKZM</option>
                <option value="0"> </option>
                <option value="0">----757----</option>
                <option value="C-GTSN">C-GTSN</option>
                <option value="0"> </option>
                <option value="0">---A320---</option>
                <option value="C-GZUM">C-GZUM</option>
              </select>
		  <?php
		  }else{
		  if($aircraft == '763'){
		  if($regrand == 1){
		  echo '<input disabled name="reg" value="C-GZUM" type="text" />';
		  echo '<input name="acftreg" value="C-GZUM" type="hidden" />';
		  }elseif($regrand == 2){
		  echo '<input disabled name="reg" value="C-GZMM" type="text" />';
		  echo '<input name="acftreg" value="C-GZMM" type="hidden" />';
		  }elseif($regrand == 3){
		  echo '<input disabled name="reg" value="C-GZNA" type="text" />';
		  echo '<input name="acftreg" value="C-GZNA" type="hidden" />';
		  }elseif($regrand == 4){
		  echo '<input disabled name="reg" value="C-GZNC" type="text" />';
		  echo '<input name="acftreg" value="C-GZNC" type="hidden" />';
		  }elseif($regrand == 5){
		  echo '<input disabled name="reg" value="G-UKZM" type="text" />';
		  echo '<input name="acftreg" value="G-UKZM" type="hidden" />';
		  }
		  }elseif($aircraft == '752'){
		  echo '<input disabled name="reg" value="C-GTSN" type="text" />';
		  echo '<input name="acftreg" value="C-GTSN" type="hidden" />';
		  }elseif($aircraft == '320'){
		  echo '<input disabled name="reg" value="C-GZUM" type="text" />';
		  echo '<input name="acftreg" value="C-GZUM" type="hidden" />';
		  }else{
		  ?>
		  <select name="tail" id="tail">
                <option value="0" selected="selected">--Select--</option>
                <option value="0"> </option>
                <option value="0">----767----</option>
                <option value="C-GZUM">C-GZUM</option>
                <option value="C-GZMM">C-GZMM</option>
                <option value="C-GZNA">C-GZNA</option>
                <option value="C-GZNC">C-GZNC</option>
                <option value="G-UKZM">G-UKZM</option>
                <option value="0"> </option>
                <option value="0">----757----</option>
                <option value="C-GTSN">C-GTSN</option>
                <option value="0"> </option>
                <option value="0">---A320---</option>
                <option value="C-GZUM">C-GZUM</option>
              </select>
		  <?php
		  }
		  }
		  ?>			  </td>
            </tr>
            <tr>
              <td colspan="2">
		  <?php
		  $book_data_sql = mysql_query("select * from flights WHERE flight_num = '{$fltnum}'");
						while($book_data = mysql_fetch_array($book_data_sql)){
		  if(empty($book_data['route'])){
                echo '<textarea name="route" rows="5" id="route" style="background:url(../images/route_bkg.jpg) no-repeat; width:100%"></textarea>';
			}else{
			echo '<input name="detailedroute" type="hidden" value="'.$detailedroute.'" />';
			echo '<textarea disabled name="route_disabled" rows="5" id="route" style="width:100%">'.$route.'</textarea>';
			echo '<input name="route" type="hidden" value="'.$route.'" />';
			}}
		  ?>			  </td>
            </tr>
            <tr>
              <td colspan="2"><label>
                <input type="submit" style="width:100%;" class="status_inputs status_blue" name="bid_flight" value="Bid Flight" />
              </label></td>
            </tr>
          </table>
        </form>
        <?php
						}}}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/85123-solved-mysql-error/#findComment-434248
Share on other sites

Do you know which query is returning the error?

 

I am assuming the INSERT INTO flightbids because when the route is not filled out it works and the only query that interacts with that form is the insert into flightbids query.

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Link to comment
https://forums.phpfreaks.com/topic/85123-solved-mysql-error/#findComment-434252
Share on other sites

Means you changed something.  It's helpful to actually post what you changed, then the problem would have been solved easier.

 

It worked before, but I do not know what happened.

 

Well... I think it actually means that I should back up my site before I change something... :P

Link to comment
https://forums.phpfreaks.com/topic/85123-solved-mysql-error/#findComment-434267
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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