IlaminiAyebatonyeDagogo Posted November 29, 2013 Share Posted November 29, 2013 (edited) how to update a database field considering a specific amount of values. the code i Know is this is to update a specific value UPDATE `users` SET `user_level`=1 WHERE `user_id`=7 and this is to update a particular field UPDATE `users` SET `user_level`=1; but the code for a range of values in a field using the id as the range say where id=7 to 35, i don't know the code Edited November 29, 2013 by IlaminiAyebatonyeDagogo Quote Link to comment https://forums.phpfreaks.com/topic/284379-how-to-update-a-database/ Share on other sites More sharing options...
Solution Ch0cu3r Posted November 29, 2013 Solution Share Posted November 29, 2013 (edited) If you want to set the user_level to 1 where user_id is between 7 and 35 then use UPDATE `users` SET `user_level`=1 WHERE `user_id` >= 7 AND `user_id` <= 35 >= means greater than or equal to <= means less than or equal to Alternatively you could use UPDATE `users` SET `user_level`=1 WHERE `user_id` BETWEEN 7 AND 35 Edited November 29, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/284379-how-to-update-a-database/#findComment-1460628 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.