Jump to content

Checkboxes..


dudejma

Recommended Posts

So I have this code, and it set's the PIREP's status to 1, but it doesn't add the flight time or change the virtual location for any flights after the first one. Here's the code. Any help would be great. Thanks guys!

 

if (isset($_POST['approve'])) {

$row = mysql_fetch_array($result);

array_map('intval',$id);
    $id = implode(',',$id);

$pilotid = $row['pilotID'];

$sql2 = "SELECT hours FROM users WHERE pilotID = '$pilotid'";

$result2 = mysql_query($sql2);

$oldHours = mysql_result($result2, 0);

$newHours = $oldHours + $row['flightTime'];

$arrival = $row['arrival'];

$expDate = date("n/j/Y", strtotime("+30 days"));

$sql3 = "UPDATE users SET hours = '$newHours', virtualLocation = '$arrival', expDate = '$expDate' WHERE pilotID = '$pilotid'";

$result3 = mysql_query($sql3);

$sql4 = "UPDATE pireps SET status = '1' WHERE id IN ($id)";

$result4 = mysql_query($sql4)
or die("An error has occured. Please contact the webmaster with the following error: " . mysql_error());

header("Location: pireps.php");

Link to comment
Share on other sites

You need to clean up your code and do things properly, using conditional statements to check wether the sql went through or not, otherwise output an error or something..

 

 

or even, to debug your code, add the die(mysql_error());

$result2 = mysql_query($sql2) or die(mysql_error());

 

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.