Jump to content

2 tables


Crew-Portal

Recommended Posts

Hi I need to know how to get this line of code:

$sql="INSERT INTO flights (PilotName, FlightDate, AircraftName, NbrPassengers, CargoWeight, DepartureIcaoName, ArrivalIcaoName, TotalDistance, TotalBlockTime, money) VALUES ('CMX-$valid_user', $time, '$_POST[plane]',

'$passengersrand', '$cargorand Lbs', '$strd', '$stra', '$_POST[distance] NM', '$_POST[hour]:$_POST[minute]', '$money_main')";

$error = $tblstart . 'Flight Sucessfully Posted!' . $tblend;

include_once($index);

and this line of code:

UPDATE user SET distance=distance+($_POST[distance]) WHERE user=$valid_user";

to work at the same time! Because I need the information to go to 2 tables at the same time and I do not know how to do this. could someone help me out?

Link to comment
https://forums.phpfreaks.com/topic/66844-2-tables/
Share on other sites

ah that hurts my head. Can someone please just help me. I dont need rollback as I believe that resets my previous command! idk how to do this. I got so far but I think I know where to draw the line in the sand! This is the only part Im stuck on so if I could just get straight up help I would very much so appreciate it!

Link to comment
https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335084
Share on other sites

$sql="INSERT INTO flights (PilotName, FlightDate, AircraftName, NbrPassengers, CargoWeight, DepartureIcaoName, ArrivalIcaoName, TotalDistance, TotalBlockTime, money) VALUES ('CMX-$valid_user', $time, '$_POST[plane]',

'$passengersrand', '$cargorand Lbs', '$strd', '$stra', '$_POST[distance] NM', '$_POST[hour]:$_POST[minute]', '$money_main'); rollback; commit; UPDATE $tbl_user SET distance=distance+($_POST[distance]) WHERE user=$valid_user";

 

doesnt work and I tried like 10 other ways I could think of after reading that html script but I still dont know?

Link to comment
https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335086
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.