son.of.the.morning Posted October 24, 2010 Share Posted October 24, 2010 I am trying to add a value of 1 to an excising numeric value in a record This is what i am using, someone sugested it and it doesnt work. $sql="UPDATE $tbl_name2 SET field = (field + 1) WHERE yes=0"; Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2010 Share Posted October 24, 2010 Does your error checking and error reporting logic in your code indicate that the mysql_query() statement executed without errors and does your mysql_affected_rows() statement in your code indicate that the row was updated or not? Short answer: Just posting a query statement out of context does not help anyone determine why it doesn't work. You have got to determine what your code IS doing to pin down which of the several possible reasons it might not be working - You could have a problem with your connection to the database server; a problem with selecting a database; your $tbl_name2 variable might not have anything or might not have the correct thing in it; your column name(s) in the query might not be correct for the table you are using; you might not be executing the a mysql_query() statement at all or it might not have the $sql variable in it... Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125873 Share on other sites More sharing options...
Pikachu2000 Posted October 24, 2010 Share Posted October 24, 2010 Do you have a field in the database named `field`, and one named `yes`? When you asked yesterday, I told you `field` would need to be the name of a field in your database . . . Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125874 Share on other sites More sharing options...
son.of.the.morning Posted October 24, 2010 Author Share Posted October 24, 2010 It's coming up no error but the records remain the same :S Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125875 Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2010 Share Posted October 24, 2010 Frankly, this thread IS the same problem as in your existing thread from yesterday. Based on reviewing that thread, you don't seem to be even executing the query in the code, so of course it is not working. Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125876 Share on other sites More sharing options...
son.of.the.morning Posted October 24, 2010 Author Share Posted October 24, 2010 It is, your right. It's just really geting on my tits, i need to have this done by tonight Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125878 Share on other sites More sharing options...
Pikachu2000 Posted October 24, 2010 Share Posted October 24, 2010 See my latest response in your other thread. Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125881 Share on other sites More sharing options...
AviNahum Posted October 24, 2010 Share Posted October 24, 2010 i know this stupid but try to replace with this field=field+1 happened to me once... and this fix my problem... Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125882 Share on other sites More sharing options...
son.of.the.morning Posted October 24, 2010 Author Share Posted October 24, 2010 is field the name of the collum? Quote Link to comment https://forums.phpfreaks.com/topic/216707-realy-need-help-here/#findComment-1125883 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.