Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing List Order, re-write to DB

Status
Not open for further replies.

Moebius01

Programmer
Joined
Oct 27, 2000
Messages
309
Location
US
I've tried a few searches, but can't come up with anything similar to what I'm trying. Here's the scoop, bear in mind that I've now been working with PHP for 48 hours...

I'm working on a site for a local small business that wants to run a video delivery service. Kind of like Netflix, but all formats and games, plus delivered by hand. I've already built the browsing engine and the add to queue function.

Queue table in database has Customer_ID, Queue_ID(priority), and Title_ID with primary key based on Customer_ID and Title_ID (prevent customer from queuing same movie twice). I'd like to build a way for a customer to update the queue, including removing items and changing the order of priority, but have hit a mental brick wall.

Anyone have any suggestions on a good approach to such a script? I'm assuming a combination of PHP and a client side script will be neccessary.

Thanks in advance for any input.
 
What does this queue do? Is it something that the user should be messing with directly, or is it something that should be updated as a second-order effect to reflect user preference changes?

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Direct. Basically a list of movies they want to rent, in priority order. I need to be able to let them change the order, or remove movies and have the order adjust (ie. if #8 is removed from queue, 9+ would adjust -1) accordingly.

I suppose in the case it's both. The user would adjust queue numbers, and if they deleted one or more, some manner of script or query (running on MySQL btw) would be needed to adjust the remaining titles.
 
Ah, I see. Each user can place an order for one or more titles, and can set preference order for all his titles.

There are a couple of options that I see.

One is that once a user has his selections in preference order the way he wants it, you simply delete all his previous preferences and insert the new ones. This is probably the easiest, but it does increase the small chance that an employee will run a report to see who wants a particular title and that user's name will not come up for that title. This would be the case that the employee pulls up user requests at the instant that that user's preferences are deleted.

Another way would be to treat the user's selections as "preference slots". Every user has 10 slots, some of which may be empty. Your script could pull up the user's slots and check each one to see if the title in that slot matches the user's just-entered preferences. If not, update each slot as necessary. You can fetch a user's slots and change each one as you go -- the rows returned when pulling preference slots is a copy of the live data, not any kind of live links to the data.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top