I have this code:
mysql_query("UPDATE users SET BasicLevel = BasicLevel +1 where username='Admin'");
but its not increasing the integer. The field names are correct as well as the username. Can anyone help me? And yes, I am connected to the database.
Well, there's nothing wrong with the basic syntax that I can see. Try `backticking` your fieldnames and tablenames, but I can't see that it would make a difference in this case.
what is BasicLevel? is this set? is it a variable from the page? you may need a subquery in your SQL
"UPDATE users SET BasicLevel = (SELECT BasicLevel+1) where username='Admin'"
BasicLevel is the int in my mySql database I need to increase.
you need to select it then first, did you try the code, works for me
It doesn't work for me... Any ideas?
thats a bit odd, did you test the code to make sure it works? BasicLevel = 6. hardcode it just to be sure. you could select the value, let php do the math then insert the value. thats the long road.
ok, try this, it's a little more structured
UPDATE users a
INNER JOIN users b ON a.username = b.username
SET a.BasicLevel = b.BasicLevel+1 where a.username='Admin'
if that don't work I have no idea? definately double check you column to make sure the datatype is int.