cooldude832 Posted October 25, 2007 Share Posted October 25, 2007 <?php $q = "Update `Table` Set Approved = '0' Where CreatorID = '"$id."'"; $r = mysql_query($q) or die(mysql_error()); ?> In my back end section users have the ability to add events, but admins can suspend accounts, I want to easily disaprove all their events when they are suspened, will that update all rows, or just one? Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/ Share on other sites More sharing options...
pocobueno1388 Posted October 25, 2007 Share Posted October 25, 2007 It would update all the rows where creatorID is equal to $id... Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377452 Share on other sites More sharing options...
teng84 Posted October 25, 2007 Share Posted October 25, 2007 <?php $q = "Update `Table` Set Approved = '0' Where CreatorID = '"$id."'"; $r = mysql_query($q) or die(mysql_error()); ?> In my back end section users have the ability to add events, but admins can suspend accounts, I want to easily disaprove all their events when they are suspened, will that update all rows, or just one? who knows we dont know your fields and your tables as well so all the answers will be 100 percent guess Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377454 Share on other sites More sharing options...
cooldude832 Posted October 25, 2007 Author Share Posted October 25, 2007 teng you don't need to be so literal, it was a conceptual idea, because I was unsure of the functionality of the SET query. Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377455 Share on other sites More sharing options...
pocobueno1388 Posted October 25, 2007 Share Posted October 25, 2007 Well, it will do exactly what it says in the WHERE clause. So anywhere "creatorID" equals $id, "Approved" will be set to 0. Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377458 Share on other sites More sharing options...
teng84 Posted October 25, 2007 Share Posted October 25, 2007 teng you don't need to be so literal, it was a conceptual idea, because I was unsure of the functionality of the SET query. oopsss sorrrryyy note always add limit 1 on your query (delete,update) if you only want to edit or delete one record Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377465 Share on other sites More sharing options...
cooldude832 Posted October 25, 2007 Author Share Posted October 25, 2007 but I want it to update all the rows Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377514 Share on other sites More sharing options...
pocobueno1388 Posted October 25, 2007 Share Posted October 25, 2007 As I said before, it will update ALL rows with a matching where clause. Does that answer your question? Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377518 Share on other sites More sharing options...
teng84 Posted October 25, 2007 Share Posted October 25, 2007 <?php $q = "Update `Table` Set Approved = '0' Where CreatorID = '"$id."'"; $r = mysql_query($q) or die(mysql_error()); ?> In my back end section users have the ability to add events, but admins can suspend accounts, I want to easily disaprove all their events when they are suspened, will that update all rows, or just one? heres how i understand your prob once you set the accounts of each member to 0 means suspend so i guess all you need to do is update only one record which is the users account then make a join in your select that will join the event poster and the events then have a condition that will only show the events of each member when they are not suspended (0) maybe Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377541 Share on other sites More sharing options...
cooldude832 Posted October 25, 2007 Author Share Posted October 25, 2007 I don't want to join my events search with the users table to see if they are active Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377553 Share on other sites More sharing options...
teng84 Posted October 25, 2007 Share Posted October 25, 2007 I don't want to join my events search with the users table to see if they are active want to easily disaprove all their events when they are suspened thats the easiest and fastest way of doing it compare to updating all the events but still it is up to you! Link to comment https://forums.phpfreaks.com/topic/74669-will-this-update-1-row-or-all-matching-rows/#findComment-377559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.