Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default Help with SQL Query

    I'm a little bit stuck and confused my self

    In the database, there's several items which all have time stamps.

    Does anyone know how I can find all the items with a time stamp with a range of:


    • Now and Yesterday
    • Yesterday and Day before yesterday
    • Day before yesterday and day before that
    • Etc..

    So in the end, it will give us this result:

    16/02/2009: item9, item8, item7
    15/02/2009: item6, item5, item4
    14/02/2009: item3, item2, item1

    Thanks, and plus rep


    Oh, and so far im using:
    PHP Code:
    $now time();
    $one strtotime("- 1 day");
    $two strtotime("- 2 day");
    $three strtotime("- 3 day");
    $four strtotime("- 4 day");
    $five strtotime("- 5 day");
    $six strtotime("- 6 day");
    $seven strtotime("- 7 day");

    $getone mysql_query("SELECT * FROM `updates` WHERE `date` > '$one' AND `date` < '$now'");
    $gettwo mysql_query("SELECT * FROM `updates` WHERE `date` > '$one' AND `date` < '$two'");
    $getthree mysql_query("SELECT * FROM `updates` WHERE `date` > '$two' AND `date` < '$three'");
    $getfour mysql_query("SELECT * FROM `updates` WHERE `date` > '$three' AND `date` < '$four'");
    $getfive mysql_query("SELECT * FROM `updates` WHERE `date` > '$four' AND `date` < '$five'");
    $getsix mysql_query("SELECT * FROM `updates` WHERE `date` > '$five' AND `date` < '$six'");
    $getseven mysql_query("SELECT * FROM `updates` WHERE `date` > '$six' AND `date` < '$seven'"); 
    Last edited by Moh; 16-02-2009 at 05:26 PM.

  2. #2
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    I'm a little bit stuck and confused my self

    In the database, there's several items which all have time stamps.

    Does anyone know how I can find all the items with a time stamp with a range of:


    • Now and Yesterday
    • Yesterday and Day before yesterday
    • Day before yesterday and day before that
    • Etc..

    So in the end, it will give us this result:

    16/02/2009: item9, item8, item7
    15/02/2009: item6, item5, item4
    14/02/2009: item3, item2, item1

    Thanks, and plus rep


    Oh, and so far im using:
    PHP Code:
    $now time();
    $one strtotime("- 1 day");
    $two strtotime("- 2 day");
    $three strtotime("- 3 day");
    $four strtotime("- 4 day");
    $five strtotime("- 5 day");
    $six strtotime("- 6 day");
    $seven strtotime("- 7 day");

    $getone mysql_query("SELECT * FROM `updates` WHERE `date` > '$one' AND `date` < '$now'");
    $gettwo mysql_query("SELECT * FROM `updates` WHERE `date` > '$one' AND `date` < '$two'");
    $getthree mysql_query("SELECT * FROM `updates` WHERE `date` > '$two' AND `date` < '$three'");
    $getfour mysql_query("SELECT * FROM `updates` WHERE `date` > '$three' AND `date` < '$four'");
    $getfive mysql_query("SELECT * FROM `updates` WHERE `date` > '$four' AND `date` < '$five'");
    $getsix mysql_query("SELECT * FROM `updates` WHERE `date` > '$five' AND `date` < '$six'");
    $getseven mysql_query("SELECT * FROM `updates` WHERE `date` > '$six' AND `date` < '$seven'"); 
    A good idea would be to give us the timestamp type, is it MySQL, UNIX?


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  3. #3
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by Jewish Bear View Post
    A good idea would be to give us the timestamp type, is it MySQL, UNIX?
    Ah sorry, Unix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •