Jump to content

Table Update


whare

Recommended Posts

Hi All

Right im having problems updating a table entry here is the code

[code]<?php

session_start();
include 'config.php';
// Form Field info
$fltnum = $_POST['fltnum'];
$actype = $_POST['actype'];
$depair = $_POST['depair'];
$deptime = $_POST['deptime'];
$arair = $_POST['arair'];
$artime = $_POST['artime'];
$flttime = $_POST['flttime'];
$fltinfo = $_POST['fltinfo'];

$userid = $_SESSION['userid'];



$sql = mysql_query("INSERT INTO pirep (userid, fltnum, actype, depair, deptime, arair, artime, flttime, fltinfo, pirep_date)
        VALUES('$userid','$fltnum','$actype','$depair','$deptime','$arair','$artime','$flttime','$fltinfo', now())")
        or die (mysql_error());

$result = mysql_query("SELECT * FROM pilot WHERE userid='$userid'");
while($row = mysql_fetch_array( $result )) {
$flttot = $row['tothour'];
$totflt = $flttime + $flttot;
}
mysql_query("UPDATE pilot SET tothour='$totflt' WHERE userid='$userid'");
$stat = $_SESSION['userlevel'];
if($stat==0){
mysql_query("UPDATE pilot SET userlevel='1' WHERE userid='$userid'");
}
mysql_query("UPDATE pilot SET lastpirep=now() WHERE userid='$userid'");
echo "Thankyou for your Pirep.";

$result = mysql_query("SELECT * FROM stats");
while($row = mysql_fetch_array( $result )) {
$pireps = $row['pireps'];
$hour = $row['hours'];
$pirep1 = $pireps + 1;
$hour1 = $hour + $totflt;
}
mysql_query("UPDATE stats SET pirep='$pirep1' AND hours='$hour1'");

?>

[/code]

now the code does not update the table but also does not return any errors in the code any ideas on this one (mostlily something simple it always is lol
Link to comment
https://forums.phpfreaks.com/topic/18025-table-update/
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.