Jump to content


Photo

Sort Function


  • Please log in to reply
2 replies to this topic

#1 wild_dog

wild_dog
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 28 May 2006 - 05:56 AM

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



#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 28 May 2006 - 05:58 AM

You can add a new field called date, cointaining the timestamp of the order. Then, just use ORDER BY (MySQL).
~ D Kuang

#3 wild_dog

wild_dog
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 28 May 2006 - 09:02 AM

[!--quoteo(post=377762:date=May 28 2006, 12:58 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 28 2006, 12:58 AM) View Post[/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

???




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users