Jump to content

LMAO... I got myself in a prediciment... again. :P


maxudaskin

Recommended Posts

Ok... there is a part in the middle where it is 'echo'ing the information from the table.

 

I want it to get the information from the table and send it to the next page (bottom), the next page uploads it to another table. But when I check the database, what it uploads is "Resource id #5" with the number being different for every entry.  Does anyone see where I went wrong?

 

checkapplicants.php

<form id="user" name="user" method="get" action="<?=$PHP_SELF; ?>">
                                
                                  <div align="center">
                                    <select name="apps" class="dropdown">
                                      <option value="0" <?php if (!(strcmp(0, $row_Recordset1['id']))) {echo "selected=\"selected\"";} ?>>Select One</option>
                                      <?php
do {  
?>
                                      <option value="<?php echo $row_Recordset1['id']?>"<?php if (!(strcmp($row_Recordset1['id'], $row_Recordset1['id']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset1['lname']?></option>
                                      <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
                                    </select>
                                    <br />
                                    <br />
                                    <input name="Submit" type="submit" class="buttons" value="View Applicant" />
                                    <br />
                                    </div>
                            </form>
                            <div align="left">
                              <?php
$id = $_GET['apps'];
$result = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");
if($_GET["Submit"])
{
while($row = mysql_fetch_array($result))
  {
  echo $row['fname'] . " " . $row['lname'];
  echo "<br />";
  echo "<br />";?>
<strong> Email </strong><br />
<?php
  echo $row['email'] . " | " . $row['emailver'];
  echo "<br />";
  echo "<br />";
?>
<strong> Password </strong><br />
<?php
  echo $row['pass'] . " | " . $row['passver'];
  echo "<br />";
  echo "<br />";
?><strong> Hub </strong><br />
<?php
  echo $row['hub'];
  echo "<br />";
  echo "<br />";
?><strong> Country </strong><br />
<?php
  echo $row['country'];
  echo "<br />";
  echo "<br />";
?><strong> Birthday (DD/MM/YYYY) </strong><br />
<?php
  echo $row['birthday'];
  echo "<br />";
  echo "<br />";
?><strong> Vatsim ID </strong><br />
<?php
  echo $row['vatsim'];
  echo "<br />";
  echo "<br />";
?><strong> Internation Virtual Aviation Organisation ID (IVAO) </strong><br />
<?php
  echo $row['ivao'];
  echo "<br />";
  echo "<br />";
?><strong> Position </strong><br />
<?php
  echo $row['position'];
  echo "<br />";
  echo "<br />";
?><strong> Resumé </strong><br />
<?php
  echo $row['reason'];
  echo "<br />";
  echo "<br />";
?><strong> Submission Date </strong><br />
<?php
  echo $row['appdate'];
  echo "<br />";
  echo "<br />";
?><strong> IP Address </strong><br />
<?php
  echo $row['ip'];
  echo "<br />";
  echo "<br />";
  }
?>
                            </div>
                            <form id="goback" name="adduser" method="post" action="adduser.php">
  
                                <div align="center">
                                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td width="210"><div align="left">
                                        <select name="role" id="role">
                                          <option value="0">Pilot</option>
                                          <option value="1">Staff</option>
                                        </select>
                                        Access Restrictions<br />
                                          <select name="hub" id="hub">
                                            <option value="1000">YYZ</option>
                                            <option value="2000">YVR</option>
                                            <option value="3000">LHR</option>
                                              </select>
Hub<br />
<?php
$result2 = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");
while($row2 = mysql_fetch_array($result2));
?>
                                      <input name="appid" type="hidden" id="appid" value="<?php echo $row2['apps'] ?>" />
                                      <input name="fname" type="hidden" id="fname" value="<?php echo $row2['fname'];?>" />
                                      <input name="lname" type="hidden" id="lname" value="<?php echo $row2['lname'];?>" />
                                      <input name="email" type="hidden" id="email" value="<?php echo $row2['email'];?>" />
                                      <input name="pass" type="hidden" id="pass" value="<?php echo $row2['pass'];?>" />
                                      <input name="hub" type="hidden" id="hub" value="<?php echo $row2['hub'];?>" />
                                      <input name="position" type="hidden" id="position" value="<?php echo $row2['position'];?>" />
                                      <input name="appdate" type="hidden" id="appdate" value="<?php echo $row2['appdate'];?>" />
                                      <input name="country" type="hidden" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="birthday" type="hidden" id="birthday" value="<?php echo $row2['birthday'];?>" />
                                      <input name="country" type="hidden" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="vatsim" type="hidden" id="vatsim" value="<?php echo $row2['vatsim'];?>" />
                                      <input name="ivao" type="hidden" id="ivao" value="<?php echo $row2['ivao'];?>" />
                                      <input name="ip" type="hidden" id="ip" value="<?php echo $row2['ip'];?>" />
</div></td>
                                    </tr>
                                  </table>
                                  <br />
                                  <input name="accept" type="submit" class="buttons" id="accept" value="Accept" />
                                </div>
                            </form>
                            <div align="left">
                              <?php
}

?>

 

adduser.php

<?php
$id = $_POST["appid"];
$hub = $_POST["hub"];
$huba = $hub/1000;
$rand = rand(001,999);
$temppid = $hub+$rand;
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$email = $_POST["email"];
$pass = $_POST["pass"];
$position = $_POST["position"];
$type = $_POST["role"];
$appdate = $_POST["appdate"];
$birthday = $_POST["birthday"];
$country = $_POST["coutry"];
$vatsim = $_POST["vatsim"];
$ivao = $_POST["ivao"];
$ip = $_POST["ip"];
$result = mysql_query("SELECT * FROM `users` WHERE `pid`='{$temppid}'");
if (mysql_num_rows($result) == 1)
{
$pidcheck = 1;
}
else
{
$pidcheck = 0;
}
do
  {
  $$temppid++;
  }
while ($pidcheck==1);
if ($pidcheck==0);
{
$pid = $temppid;
$sql="INSERT INTO users (appid, fname, lname, email,  pass,  hub, birthday, country, vatsim, ivao, position, ip, acceptdate, appdate, type, pid)
VALUES
('$id','$fname','$lname','$email','$pass','$hub','$birthday','$country','$vatsim','$ivao','$position','$ip', NOW( ), '$appdate', '$type', $pid)";

if (!mysql_query($sql,$LeadHost))
  {
  die('Error: ' . mysql_error());
  }
echo "1 user added...";
echo "</br>";
echo "</br>";
echo "Thank you For Using Max Udaskin's Virtual Airline Administration Script.";
}

?>

Link to comment
Share on other sites

Can you post a copy of your output?  Which part is printing "Resource id #5"?

 

Typically that will occur if you try to use a mysql result directly rather than using mysql_fetch_assoc/mysql_fetch_array to extract the data first.

 

 

Link to comment
Share on other sites

Try printing out your sql statements.  The problem may not be in the code you posted, so print out other sql statements as well.  Especially print out ALL update and insert SQL statements, so you can verify that they are doing what you expect them to.

Link to comment
Share on other sites

Ok, if that is your whole script, then you have a missing mysql query in the first script.  You cannot fetch from a mysql result until you have done a query.  You have another problem in that there is no mysql_connect() or mysql_select_db().  You cannot do mysql queries without connecting to a database.

 

It may not be relevant, but variables from one run of the script (eg, before the form was submitted) are NOT preserved after the form is submitted.

Link to comment
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.