wild_dog Posted May 28, 2006 Share Posted May 28, 2006 Hi there,Im trying to write a function that does the following:I have a form which has items from a mysql database. At the moment when you clickon an item from the page and add it to a cart the items are being displayed in random order.I want the items to be displayed in the order they are clicke onAny ideas??Cheers Quote Link to comment https://forums.phpfreaks.com/topic/10630-sort-function/ Share on other sites More sharing options...
poirot Posted May 28, 2006 Share Posted May 28, 2006 You can add a new field called date, cointaining the timestamp of the order. Then, just use ORDER BY (MySQL). Quote Link to comment https://forums.phpfreaks.com/topic/10630-sort-function/#findComment-39640 Share on other sites More sharing options...
wild_dog Posted May 28, 2006 Author Share Posted May 28, 2006 [!--quoteo(post=377762:date=May 28 2006, 12:58 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 28 2006, 12:58 AM) [snapback]377762[/snapback][/div][div class=\'quotemain\'][!--quotec--]You can add a new field called date, cointaining the timestamp of the order. Then, just use ORDER BY (MySQL).[/quote]Yes i thought about that, however what i belive will happen in that case is this:Eveytime you go and add an item it will read the order the items are stored inthe database and display them according to how they are stored.What i want to make sure is that whatever item(s) the user selects thats whatthey will see in their list so that they are displayed in the order clicked.I was thinking maybe:1. Include MySQL query in PHP function to Store/Push them into an array as they are selected (Not sure how though)2. Print the array to screen3. ORDER by Category, Item??? Quote Link to comment https://forums.phpfreaks.com/topic/10630-sort-function/#findComment-39655 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.