Jump to content

show results depending on date?


xwishmasterx

Recommended Posts

Hello

 

I am not sure that this is even possible, but then again I am not an expert in the php-arena :-)

 

I have this piece of code that shows the top 100 sponsors:

 

$rs=mysql_query("select * from topref order by ref desc limit 0,100");
while($arr=mysql_fetch_array($rs)) {
$rs1=mysql_query("select * from users where Username='$arr[0]'");
$arr1=mysql_fetch_array($rs1);
echo "<br> User:$arr[0] have $arr[1] Referrals";

 

Is it possible to show the results for "last week" and "current week"

 

The members have a signup date located in the "users" table..

 

Let me know if you need more info :-)

 

Regards,

Casper

Link to comment
Share on other sites

First, why not a JOIN?  And it's very scary to use array references like that... in fact, you mean $arr1 on your last line.  I'm just guessing column names here....

 

select t.ref, u.username from topref inner join users where u.username = t.username order by t.ref desc limit 100

 

As for your actual question, you can use WHERE signup_date > CURDATE() - INTERVAL 7 DAY.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.