php - How to change multiple values with SQL? -


is possible change multiple table values 1 sql query? instance, table named "newsletter" has column named "received" has enum value defaults 0. when send newsletter out, value gets changed 1, recipient doesn't receive same email twice. want make script when parsed change of received values 0, can send newsletter. provide php code far, , have tested links , database connection file connecting database no issue.

php

include_once "connect_to_mysql.php"; $rec_value =  mysql_query("select * newsletter received='1'"); $numrows = mysql_num_rows($rec_value); while($row = mysql_fetch_array($rec_value)){     $email = $row["email"];     if ($numrows == 1) {          mysql_query("update newsletter set received='0' email='$email'");     }  }  

can me change code sets received values 0 when script executed? thanks!

you mean simply:

update newsletter set received='0' 

mysql won't update rows '0' , update rows other values '0'.

but if want more exact , update rows received '1':

update newsletter set received='0' received='1' 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -