LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-20-2006, 02:59 AM   #1
binary_dreamer
Member
 
Registered: Feb 2006
Distribution: debian squeeze
Posts: 199

Rep: Reputation: 31
L.A.M.P and selection


hi. i got a task to finish, but i am not sure on how to implement it. the task is:
there is a database of 50 entries (with the option to add/remove entries). those entries will be in three groups ABC. group A will have the first 13, group B the next 13, and group C the rest. i want to have a script that for Monday to Friday will take from group A, one everyday and in serial mode. for weekends it will choose:
Saturday: one from B and one from C
Sunday: one from B and one from C.
any ideas on how to help me on that task?
 
Old 06-20-2006, 03:05 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
You may want to add a field to your table that will record the last one selected (or if you wish the next one to be selected)
Throw all of the rows for a given group into an array and search the array for the last one, return the next.
Finally update the table to properly reflect the last selected record.
 
Old 06-20-2006, 05:53 AM   #3
binary_dreamer
Member
 
Registered: Feb 2006
Distribution: debian squeeze
Posts: 199

Original Poster
Rep: Reputation: 31
thanks alot for the reply. the problem is that i am kinda confused with the queries i have to make. how do i differentiate the groups between weekdays and the weekends?
 
Old 06-20-2006, 07:13 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
If the database doesn't hold the group information then it can probably be generated by using limit to get the first and last items, I'm not certain of the exact syntax but you should be able to find it in the manual.
 
Old 06-20-2006, 08:07 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
See this page for various date / day fns: http://dev.mysql.com/doc/refman/4.1/...functions.html
 
Old 06-21-2006, 02:05 AM   #6
smallville
Member
 
Registered: Dec 2005
Posts: 44

Rep: Reputation: 15
use limit 10 for the first 10 then, limit 10, 10 for the next 10 (or limit 11,10)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel selection jimbrook SUSE / openSUSE 6 06-02-2005 08:55 AM
Help With Selection of Monitor neoAThome Linux - Hardware 0 01-17-2005 03:26 AM
CPU selection eYao Linux - Hardware 2 12-09-2004 07:15 PM
A little Motherboard selection help? Shade Linux - Hardware 9 05-15-2004 07:55 PM
Linux Selection softair Linux - Newbie 4 06-19-2003 06:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration