andrew6607 Posted April 4, 2008 Share Posted April 4, 2008 Hello, I am trying to set up a System For A Virtual Airline. When someone enters the amount of hours they did on a flight and then it ads it to the currents hours in the database. Example.. They currently have 200 Hours logged. And They submit a report with 2.8 Hours. So then the table would be updated and then say they have 202.8 Hours. Thanks! Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 4, 2008 Share Posted April 4, 2008 so whats your question? Quote Link to comment Share on other sites More sharing options...
andrew6607 Posted April 4, 2008 Author Share Posted April 4, 2008 The Questions is.. How Would i get the 2.8 Hours into the database so it would equal 202.8? Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 4, 2008 Share Posted April 4, 2008 run a mysql_query to select the hours, mysql_query("SELECT hours FROM table_name") and then add 2.8 to it. Quote Link to comment Share on other sites More sharing options...
andrew6607 Posted April 4, 2008 Author Share Posted April 4, 2008 Yea i know about the query. But how would i add the hours to the table. Thats What IM Wondering! Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 4, 2008 Share Posted April 4, 2008 $hours = mysql_fetch_array($query); $new_hours = $hours['hours'] + 2.8 mysql_query("UPDATE table_name SET hours = '$new_hours'"); (might need to add a WHERE in there if you have multiple rows and only want one row to be affected) Quote Link to comment 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.