Jump to content

Sort Function


wild_dog

Recommended Posts

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 click
on 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 on

Any ideas??


Cheers

Link to comment
https://forums.phpfreaks.com/topic/10630-sort-function/
Share on other sites

[!--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 in
the 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 what
they 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 screen
3. ORDER by Category, Item

???
Link to comment
https://forums.phpfreaks.com/topic/10630-sort-function/#findComment-39655
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.