Youko Posted November 14, 2007 Share Posted November 14, 2007 So, I don't really know how to achieve this with php, so any help would be much appriciated. I bet this is so simple of a solution, I'll look like an idiot. :-\ So. I have 2 MySQL tables. I wan't to take an value from a cell on table 1, substract that from a cell from table 2 so that the new value saves to the cell on table 2. Like: money - item_price = this much money Thank's in advance! Quote Link to comment Share on other sites More sharing options...
farkewie Posted November 14, 2007 Share Posted November 14, 2007 you can give this a go.. <?php $cost = (($table1_row['price']) - ($table2_row['price'])); echo $cost; ?> you will have to do your querys fisrt and change the code to suit your variable in the querys. Quote Link to comment Share on other sites More sharing options...
Youko Posted November 14, 2007 Author Share Posted November 14, 2007 Thanks for the quick reply! The problem is I don't know how to do so. Also, instead of just printing the aammount left, I'd want it to be inserted back to the money cell. Quote Link to comment Share on other sites More sharing options...
farkewie Posted November 15, 2007 Share Posted November 15, 2007 Go here and take a look get some code going when you start getting errors try google or searching this site. then post again if need be. http://www.php.net/manual/en/ref.mysql.php 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.