Wildhalf Posted November 5, 2012 Share Posted November 5, 2012 I Have asked on stack overflow but im not getting a good answer so decided to come here. I am a learn as you go php programmer.... but think i am a bit out data by the looks of things any way if you look at the following question it will show you what i am trying to do http://stackoverflow.com/questions/13238787/php-select-update-statement-to-return-and-update-a-multi-dimensional-array & http://stackoverflow.com/questions/13117872/php-rotate-and-adding-to-an-array thanks in advance to anyone who can help Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/ Share on other sites More sharing options...
Barand Posted November 5, 2012 Share Posted November 5, 2012 1 -> a 2 -> e 3 -> b 4 -> f 5 -> c 5 -> g 5 -> d I'm afraid that what you ask is impossible. Array keys must be unique, you have 3 with key = 5. Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390425 Share on other sites More sharing options...
Wildhalf Posted November 5, 2012 Author Share Posted November 5, 2012 sorry that was my fault that should be 5, 6,7 If you look at first link you will see what my table looks like the second one was me trying to ask with out showing the table... stupid really Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390426 Share on other sites More sharing options...
kicken Posted November 5, 2012 Share Posted November 5, 2012 Even after reading both the stack overflow threads, I haven't the foggiest idea what it is you're after. Perhaps if you better explain your end goal and why exactly you want to do what you are trying to do someone could better understand what you want and offer help. Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390438 Share on other sites More sharing options...
Wildhalf Posted November 5, 2012 Author Share Posted November 5, 2012 Kicken, Sorry for being so confusing. Basically i am building a rotator script. Here is how my database looks: both id & fb_user_id are unique for every entry. What i am doing is building a kind of affiliate system with signup page with a form. I am rotating the sponsors link on the page so they are in order related to who joined first. When someone gets a signup they are put on the end of the rotation again untill they have say 2 signups. So when a new user signs up via the rotator page the order goes from fb_user_id - oder 1 - 1 2 - 2 3 - 3 to this fb_user_id - oder 1 - 4 2 - 1 3 - 2 4 - 3 so the new member goes in 3rd in line and the person who referred them goes in right behind them in 4th unless that had been there 2nd signup in this case they will no longer be in the rotation. Do you have any more questions?? Hope this makes it a bit clearer Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390444 Share on other sites More sharing options...
play_ Posted November 6, 2012 Share Posted November 6, 2012 Are you simply trying to rotate the array? You marked your first link in SO as solved. The second link seems like a similar problem so i'm not exactly sure what the specific issue is. Are you trying to rotate the array you get when you retrieve the 'order' column? Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390517 Share on other sites More sharing options...
Wildhalf Posted November 6, 2012 Author Share Posted November 6, 2012 That's exactly what I'm trying to do. Add a new entry to the array then rotate the array and update database Quote Link to comment https://forums.phpfreaks.com/topic/270334-php-select-update-statement-to-return-and-update-a-multi-dimensional-array/#findComment-1390527 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.