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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 there is no error, nothing happens Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 yes, i meant $paid Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
gple Posted April 28, 2009 Author Share Posted April 28, 2009 figured it out. Quote Link to comment Share on other sites More sharing options...
nankoweap Posted April 28, 2009 Share Posted April 28, 2009 and the problem was? Quote Link to comment 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... Quote Link to comment 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. 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.