Crew-Portal Posted August 27, 2007 Share Posted August 27, 2007 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 More sharing options...
vijayfreaks Posted August 27, 2007 Share Posted August 27, 2007 Hi.. use begin,rollback and commit accordingly your requirement. refer: http://www.devarticles.com/c/a/MySQL/Using-Transactions-with-MySQL-4.0-and-PHP/ -Vijay Link to comment https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335083 Share on other sites More sharing options...
Crew-Portal Posted August 27, 2007 Author Share Posted August 27, 2007 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 More sharing options...
Crew-Portal Posted August 27, 2007 Author Share Posted August 27, 2007 $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 More sharing options...
vijayfreaks Posted August 27, 2007 Share Posted August 27, 2007 Hi.. this is not the way of use this see the following: http://www.thescripts.com/forum/thread3669.html -vijay Link to comment https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335093 Share on other sites More sharing options...
Crew-Portal Posted August 27, 2007 Author Share Posted August 27, 2007 Thank You That helped! Ah that makes me feel better! TOPIC SOLVED!!! Link to comment https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.