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! Link to comment https://forums.phpfreaks.com/topic/77391-help-with-php-mysql/ 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. Link to comment https://forums.phpfreaks.com/topic/77391-help-with-php-mysql/#findComment-391773 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. Link to comment https://forums.phpfreaks.com/topic/77391-help-with-php-mysql/#findComment-391782 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 Link to comment https://forums.phpfreaks.com/topic/77391-help-with-php-mysql/#findComment-392180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.