Jump to content

Insert Into *... Not working for some reason


Recommended Posts

I have this system where it inserts a copy of an entry from another table i have but iwith the user's name in it....

 

but its just putting there info not the whole thing in it... i have set up an acount for testing which you can view here http://bluewavesvirtual.com/index1.php user is BWA1015 password is 1234567890... you need to then click on "place a bid" the click "place "... it will bring you to here http://bluewavesvirtual.com/pilot-bidview.php?id=1 then you click place bid and it is suppost to insert it into the database but it does that but only the session varibles... here is the scripts for each page

**the database info is different than the real ones

 

ANY HELP Is Grately Apprechated (i cant spell)

 

Pilot View Bid.php

<?php $pagename = "File Current Bid"; ?>
<?php
$host="localhost"; // Host name 
$username="pacifij1_blue"; // Mysql username 
$password="8336994895"; // Mysql password 
$db_name="pacifij1_blue"; // Database name 
$tbl_name="pilot"; // Table name 




session_start();


if(!session_is_registered('callsign') AND !session_is_registered('pwd') AND !session_is_registered('first_name') AND !session_is_registered('last_name')){ 

header( 'Location: http://bluewavesvirtual.com/');

exit();

}

$hostname = "localhost";   
$database = "pacifij1_blue"; 
$username = "pacifij1_blue"; 
$password = "8336994895"; 
$vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); 

$callsign = $_SESSION['callsign']; 



mysql_select_db($database, $vrbo);
$query_pilots = "SELECT * FROM pilot where callsign = '$callsign'";
$pilots = mysql_query($query_pilots, $vrbo) or die(mysql_error());
$row_pilots = mysql_fetch_assoc($pilots);
$totalRows_pilots = mysql_num_rows($pilots);

$id = $_GET['id']; 

mysql_select_db($database, $vrbo);
$query_bids = "SELECT * FROM flights WHERE id = '$id'";
$bids = mysql_query($query_bids, $vrbo) or die(mysql_error());
$row_bids = mysql_fetch_assoc($bids);
$totalRows_bids = mysql_num_rows($bids);


?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Blue Waves Virtual Airlines :: <?php echo $pagename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #808080}
-->
</style>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
</head>

<body>
<div align="center">
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td><img src="images/toplayer.jpg" width="800" height="20"></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><img src="banners/banners.jpg" width="800" height="150"></td>
    </tr>
  </table>
<?php include("includes/pilotmainmenu.php"); ?>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
    
      <td width="144"><p align="center"> </p>
        <p align="center"> </p>
        <p align="center">First Name: <?php echo $row_pilots['first_name']; ?></p>
        <p align="center">Last Name: <?php echo $row_pilots['last_name']; ?></p>
        <p align="center">City: <?php echo $row_pilots['city']; ?></p>
        <p align="center">State: <?php echo $row_pilots['state']; ?></p>
        <p align="center">Country: <?php echo $row_pilots['country']; ?></p>
        <p align="center">About: <?php echo $row_pilots['about']; ?></p>
        <p align="center">Hours:
          <?php
		  
		  $last_name = $row_pilots['last_name']; 

		  

		mysql_select_db($database, $vrbo);
$tt = 0;
$midnight = strtotime(date('Y-m-d') . ' 00:00:00');



mysql_select_db($database, $vrbo);
$query_h = "SELECT ete FROM pireps WHERE last_name = '$last_name' and approved = '1'";
$h = mysql_query($query_h, $vrbo) or die(mysql_error());


while($r = mysql_fetch_assoc($h))
$tt += strtotime($r['duration']) - $midnight;
$hours = floor($tt/3600);
$x = $tt - floor($tt/3600)*3600;
$mins = floor($x/60);
$secs = $x - floor($x/60) * 60;
echo  $hours . ':' . $mins;
?>
        </p>
        <p align="center"><a href="pilot-edit_profile.php" class="linkblue">EDIT</a></p>
        <p> </p>
        <p>          </p>
      <p> </p></td>
      <td width="556"><p align="center">
          <p align="center">
            <?php include("includes/pilotmenu.php"); ?>
        <p><form id="bid" action="pilot-bid-place.php" ></p>
          <p>Aircraft: <span id="sprytextfield2">
          <label>
          <input type="text" readonly name="aircraft" id="aircraft" value="<?php echo $row_bids['aircraft']; ?>">
          </label>
          <span class="textfieldRequiredMsg">A value is required.</span></span></p>
          <p>Flight Number:          <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="flight_number" id="flight_number" value="<?php echo $row_bids['flight_number']; ?>">
            </label>
            <span class="textfieldRequiredMsg">A value is required.</span></span></p>
          <p>From Airport: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="from_airport" id="from_airport" value="<?php echo $row_bids['from_airport']; ?>">
            </label>
            <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>To Airport: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="to_airport" id="to_airport" value="<?php echo $row_bids['to_airport']; ?>">
            </label>
            <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>From Airport ICAO: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="from_icao" id="from_icao" value="<?php echo $row_bids['from_icao']; ?>">
            </label>
            <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>To Airport ICAO: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="to_icao" id="to_icao" value="<?php echo $row_bids['to_icao']; ?>">
            </label>
            <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>ETE: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="ete" id="ete" value="<?php echo $row_bids['ete']; ?>">
            </label>
          <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>Route: <span id="sprytextfield1">
            <label>
            <input type="text" readonly name="route" id="route" value="<?php echo $row_bids['route']; ?>">
            </label>
          <span class="textfieldRequiredMsg">A value is required.</span></p>
          <p>
            <label>
            <input type="submit" class="button" name="submit" id="submit" value="File Bid!">
            </label>
          </p>
        </form>
<p align="center"> </p>
        <p><br>
      </p></td>
      <td width="100">Hello <?php echo $row_pilots['first_name']; ?>,  Welcome</p>
      <p><a href="logout.php" class="linkblue">Logout</a>
        <p></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center"><font color="#808080">©2008 Blue Waves Virtual 
          Airlines. Logos And Slogans And All Other Property 
          Are Part Of Blue Waves Virtual Airlines And May Never Be Redestributed. 
      All Rights Reserved.</font></div></td>
    </tr>
    <tr>
      <td><img src="images/bottomlayer.jpg" width="800" height="50"></td>
    </tr>
  </table>
  <p> </p>
  <p>  </p>
</div>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
//-->
</script>
</body>
</html>

 

pilot-bid-place.php

<?php $pagename = "File Current Bid"; ?>
<?php
$host="localhost"; // Host name 
$username="pacifij1_blue"; // Mysql username 
$password="8336994895"; // Mysql password 
$db_name="pacifij1_blue"; // Database name 
$tbl_name="pilot"; // Table name 




session_start();


if(!session_is_registered('callsign') AND !session_is_registered('pwd') AND !session_is_registered('first_name') AND !session_is_registered('last_name')){ 

header( 'Location: http://bluewavesvirtual.com/');

exit();

}

$hostname = "localhost";   
$database = "pacifij1_blue"; 
$username = "pacifij1_blue"; 
$password = "8336994895"; 
$vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); 

$callsign = $_SESSION['callsign']; 
$last_name = $_SESSION['last_name']; 




$hostname = "localhost";   
$database = "pacifij1_blue"; 
$username = "pacifij1_blue"; 
$password = "8336994895"; 
$vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); 

$aircraft = $_POST['aircraft'];
$flight_number = $_POST['flight_number'];
$from_airport = $_POST['from_airport'];
$to_airport = $_POST['to_airport'];
$from_icao = $_POST['from_icao'];
$to_icao = $_POST['to_icao'];
$ete = $_POST['ete'];
$route = $_POST['route'];

mysql_select_db($database, $vrbo);
$query_in = "INSERT INTO pireps (callsign, last_name, aircraft, flight_number, from_airport, to_airport, from_icao, to_icao, ete, route) VALUES ('$callsign', '$last_name', '$aircraft', '$flight_number', '$from_airport', '$to_airport', '$from_icao', '$to_icao', '$ete', '$route')";
$in = mysql_query($query_in, $vrbo) or die(mysql_error());


?> 




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Blue Waves Virtual Airlines :: <?php echo $pagename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #808080}
-->
</style>
</head>

<body>
<div align="center">
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td><img src="images/toplayer.jpg" width="800" height="20"></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><img src="banners/banners.jpg" width="800" height="150"></td>
    </tr>
  </table>
<?php include("includes/pilotmainmenu.php"); ?>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
    
      <td width="144"><p align="center"> </p>
        <p align="center"> </p>
        <p align="center">First Name: <?php echo $row_pilots['first_name']; ?></p>
        <p align="center">Last Name: <?php echo $row_pilots['last_name']; ?></p>
        <p align="center">City: <?php echo $row_pilots['city']; ?></p>
        <p align="center">State: <?php echo $row_pilots['state']; ?></p>
        <p align="center">Country: <?php echo $row_pilots['country']; ?></p>
        <p align="center">About: <?php echo $row_pilots['about']; ?></p>
        <p align="center">Hours:
          <?php
		  
		  $last_name = $row_pilots['last_name']; 

		  

		mysql_select_db($database, $vrbo);
$tt = 0;
$midnight = strtotime(date('Y-m-d') . ' 00:00:00');



mysql_select_db($database, $vrbo);
$query_h = "SELECT ete FROM pireps WHERE last_name = '$last_name' and approved = '1'";
$h = mysql_query($query_h, $vrbo) or die(mysql_error());


while($r = mysql_fetch_assoc($h))
$tt += strtotime($r['duration']) - $midnight;
$hours = floor($tt/3600);
$x = $tt - floor($tt/3600)*3600;
$mins = floor($x/60);
$secs = $x - floor($x/60) * 60;
echo  $hours . ':' . $mins;
?>
        </p>
        <p align="center"><a href="pilot-edit_profile.php" class="linkblue">EDIT</a></p>
        <p> </p>
        <p>          </p>
      <p> </p></td>
      <td width="556"><p> </p>
        <p align="center"><img src="images/careerimg.jpg" alt="Carrer Image" width="288" height="193"></p>
        <p align="center">Hello And Welcome To Your Pilot Overview</p>
        <p align="center">
          <?php include("includes/pilotmenu.php"); ?>
          <p>
        <p align="center"> </p>
        <p><br>
      </p></td>
      <td width="100">Hello <?php echo $row_pilots['first_name']; ?>,  Welcome</p>
      <p><a href="logout.php" class="linkblue">Logout</a>
        <p></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center"><font color="#808080">©2008 Blue Waves Virtual 
          Airlines. Logos And Slogans And All Other Property 
          Are Part Of Blue Waves Virtual Airlines And May Never Be Redestributed. 
      All Rights Reserved.</font></div></td>
    </tr>
    <tr>
      <td><img src="images/bottomlayer.jpg" width="800" height="50"></td>
    </tr>
  </table>
  <p> </p>
  <p>  </p>
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/96243-insert-into-not-working-for-some-reason/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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