I am trying to use one script to insert values from a form into one table (which is working fine). In addition, I want to take one of the variables ($date) and UPDATE another table with that information.
Here is the script so far....
<?php
$db = mysql_connect("localhost", "maceo100","scarlet");
mysql_select_db("margaritaair_com",$db);
$date=$_POST['date'];
$name=$_POST['name'];
$macid=$_POST['macid'];
$hours=$_POST['hours'];
$type=$_POST['type'];
$departure=$_POST['departure'];
$destination=$_POST['destination'];
$charterno=$_POST['charterno'];
$charterdoll=$_POST['charterdoll'];
$comment=$_POST['comment'];
$image=$_POST['image'];
$sql = "INSERT INTO flightlog (date, name, macid, hours, type, departure, destination, charterno, charterdoll, comment, image) VALUES ('$date', '$name', '$macid','$hours','$type','$departure','$destination','$charterno','$charterdoll','$comment','$image')";
$result = mysql_query($sql);
if ($result) {
echo ("PIREP recorded successfully");
}
SELECT * FROM pilots WHERE macid='$macid'
$sql = "UPDATE pilots (pirepdate) VALUES ('$date') WHERE macid="$macid";
$result = mysql_query($sql);
if ($result) {
echo ("Thank You for flying with Margarita Air Club");
}
MySQL_close()
?>
I want to update the record titled 'pirepdate' in the table 'pilots' with the same date that was used to insert into 'flightlog' as 'date' for the record that has the same 'macid' (the users member number).
I can get the script to do one or the other, but not both.
Any ideas?