gple Posted April 28, 2009 Share Posted April 28, 2009 I am passing a integer variable as $paid. I want to run an update query so that it adds the amount to a particular column: mysql_query("UPDATE captains_list SET amount_paid=amount_paid+$payment where id='$id'"); this code obviously does not work. can someone look at this. Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/ Share on other sites More sharing options...
revraz Posted April 28, 2009 Share Posted April 28, 2009 That should work fine, what's the error. Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821159 Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 there is no error, nothing happens Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821160 Share on other sites More sharing options...
mrMarcus Posted April 28, 2009 Share Posted April 28, 2009 where did $payment come from? did you mean $paid? Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821162 Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 yes, i meant $paid Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821163 Share on other sites More sharing options...
nankoweap Posted April 28, 2009 Share Posted April 28, 2009 this may be a stupid question, but you connected to the database, right? why not pass that resource link in your query statement so there are no assumptions? what about the id column? how are you obtaining the appropriate ID value to update? what's the value returned from mysql_num_rows after the update is performed? jason Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821182 Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 I put the query within an if statement and it is failing. Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821187 Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 figured it out. Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821196 Share on other sites More sharing options...
nankoweap Posted April 28, 2009 Share Posted April 28, 2009 and the problem was? Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821206 Share on other sites More sharing options...
mattal999 Posted April 28, 2009 Share Posted April 28, 2009 My guess - There was nothing wrong. That statement doesn't echo anything after completing itself... Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821212 Share on other sites More sharing options...
nankoweap Posted April 28, 2009 Share Posted April 28, 2009 hehe. i was assuming he was validating the update with a query from the command line or something. Link to comment https://forums.phpfreaks.com/topic/155994-solved-add-in-update-query/#findComment-821261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.