iceblox Posted April 30, 2008 Share Posted April 30, 2008 For what im trying to do i think i need run it through an array? how would i array a result so that it performs that action for each entry and not just the last one? Link to comment https://forums.phpfreaks.com/topic/103612-arrays/ Share on other sites More sharing options...
p2grace Posted April 30, 2008 Share Posted April 30, 2008 We need some code. For a general understanding of arrays check out: http://us2.php.net/array Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530543 Share on other sites More sharing options...
jonsjava Posted April 30, 2008 Share Posted April 30, 2008 need to know what you mean by "result" is that a MySQL result? a form result? A result of adding something together? what do you mean? sorry, I'm just not sure what you are talking about when you say result. Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530545 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 Sorry my apologies trying to do two things at once. I have this code if(!empty($_POST["savebutton"])) { $result = $db->sql_query("UPDATE ".$prefix."_leaderboardteam SET tpoints='".forSql($_POST["tpoints"])."' WHERE leadid ='".forSql($_POST["leadid"])."'"); if($result) $status = "<b>".$_POST["leadid"] . " successfully updated</b>"; else { echo "<b>You have broken it!</b>"; print_r($db->sql_error($result)); } } And there are many rows that need to be updated in one click how would i put that code into an array? Thanks Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530553 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 Use a while loop. >_> Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530560 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 any examples? Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530563 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 Now, what do you mean "for each entry"? Is there a form with a multiple select field? >_> Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530564 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 Yeah, basically there is a list with all the teams on to update the points. you simply put the points in and then click save to update all the entries at the same time. Currently it is only updating the last one in the list. Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530568 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 Can you possibly link me to a screenshot of the page, or link me to the page? I just want to see what the form looks like, and then I can help you with no problem. =) Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530569 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 Basically where the numbers are this will change to input boxes with the submit button below [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530572 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 How are you passing the IDs of the teams? Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530580 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 i posted them using a hidden tag so i am calling them via POST on the where clause Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530581 Share on other sites More sharing options...
iceblox Posted April 30, 2008 Author Share Posted April 30, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530604 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 Check my PM. Link to comment https://forums.phpfreaks.com/topic/103612-arrays/#findComment-530619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.