homepage Welcome to WebmasterWorld Guest from 107.21.135.68
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
multiple queries, random userID from
dsat




msg:4193418
 8:19 am on Aug 28, 2010 (gmt 0)

Apologize for my poor English.

I have not been programmed at about 4 years, so I need some help. There is a need to do photo analysis system for educational purposes. To encourage more voting, script chosen random winner, who are voting for at least 15 times a week.

**

I need a script that, chosen random (userID), who are voting for at least 15 times a week.

If there is more than one, script randomly selects a winner (preference to those who have never won).

In this example, according to the winner should show every Monday.

The week starts on Monday at 00:00:00 and ends on Sunday at 23:59:59.

Server: Linux, Apache 2, PHP 5, MySQL 5

table 'ExampleTable'

$StartTime = '2010-11-01'; // Voting begins

$EndTime = '2010-12-05'; // Voting ends

$MinRecord = '15'; // minimal records in the last seven days (week) of the table "ExampleTable"

$MaxWin = '1'; // max winner of the week.


table 'Votings'

VoteID (INT)
GalleryID (INT)
PictureID (INT)
UserID (INT)
Voting (TINYINT)
VoteTime (DATETIME)

table 'winners'

winID
galleryID
userID
winnerDay (DATETIME)

 

dsat




msg:4193419
 8:22 am on Aug 28, 2010 (gmt 0)

before was wrong table name in comment

$MinRecord = '15'; // minimal records in the last seven days (week) of the table "Votings"

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved