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? Quote 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 Quote 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! Quote 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? Quote 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 Quote 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!!! Quote Link to comment https://forums.phpfreaks.com/topic/66844-2-tables/#findComment-335111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.