php - MySQL simple query -


I do not know what I'm doing, but I'm not really good with MySQL. I basically have a table in my database whose column is "position". If the statement is correct then I want to change the position of "1", and if I want to convert its false to "0".

When I get worried, MySQL is a query, I have a part of PHP which is all set up and working (it has been tested with echo).

My current query: (This happens after my PP if-statement)

  mysql_query ('UPDATE page WHERE id = "'. $ Id. '" SET Status = "1" '); The way I define the $ ID:  
  if (isset ($ _GET ['id'])) {$ id = intval ($ _GET ['id']) ; }   

thanks !!

Since you want to update < all records (from your description) You can

  UPDATE page SET `status` = case when id = $ id then 1 and 0 end    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -