IlaminiAyebatonyeDagogo Posted November 29, 2013 Share Posted November 29, 2013 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 Link to comment https://forums.phpfreaks.com/topic/284379-how-to-update-a-database/ Share on other sites More sharing options...
Ch0cu3r Posted November 29, 2013 Share Posted November 29, 2013 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 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
Archived
This topic is now archived and is closed to further replies.