Jump to content

Update field to +1


IndianaGuy
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...