IndianaGuy Posted March 20, 2017 Share Posted March 20, 2017 I am trying to make an INT field in my database to be updated from current value to current value +1. I have this so far but the value is not updating. Thank you $sql2 = "UPDATE tbl_team SET TM_Counter = TM_Counter + 1 WHERE TM_code=$access_code"; $result2=mysqli_query($sql2); Link to comment Share on other sites More sharing options...
justsomeguy Posted March 20, 2017 Share Posted March 20, 2017 The WHERE clause probably doesn't match any rows. Or maybe there's a database error that you're not checking for, I can't tell with just those 2 lines. You should use prepared statements for that though, mysqli supports them and you should use a prepared statement any time you need to put any data in a query. Link to comment Share on other sites More sharing options...
Ingolme Posted March 20, 2017 Share Posted March 20, 2017 My guess is that either TM_code is supposed to be a string or $access_code has an unexpected value. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now