Need PHP Help - Related to mysql.

Discussion in 'PHP' started by hiteshb, Sep 24, 2009.

  1. #1
    I am having database of some fixtures of sports.

    Currently by add below, it shows future fixtures but I want to add function of Results of Matches. So I just want to show past fixtures. The below is code added to show only future fixtures and neglect anything past.

    $currentdate = date("Y-m-d");
    
    Code (markup):
    What should I change to show past fixtures.
     
    hiteshb, Sep 24, 2009 IP
  2. orionoreo

    orionoreo Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not 100% sure of your question

    is $currentdate = date("Y-m-d"); being passed to show the fixtures?

    if so then you have to add a timestamp that indicates past data such as

    
    
    //Make a timestamp
    $previous_time = mktime(1, 0, 0, 9, 24, 2009); // change 1, 0, 0, 9, 24, 2009 - h, i, s, m, d, y
    
    //Changing your current date
    $currentdate = date("Y-m-d", $previous_time);
    
    
    
    PHP:
     
    orionoreo, Sep 24, 2009 IP
  3. hiteshb

    hiteshb Well-Known Member

    Messages:
    1,392
    Likes Received:
    101
    Best Answers:
    0
    Trophy Points:
    155
    #3
    ok. i want to show past 60 day records and no future records. how ?
     
    hiteshb, Sep 24, 2009 IP
  4. hiteshb

    hiteshb Well-Known Member

    Messages:
    1,392
    Likes Received:
    101
    Best Answers:
    0
    Trophy Points:
    155
    #4
    see in fixtures, date of match are like 25 sep, 26 sep. but for result it must show 24 sep, 23 sep.
     
    hiteshb, Sep 24, 2009 IP
  5. hiteshb

    hiteshb Well-Known Member

    Messages:
    1,392
    Likes Received:
    101
    Best Answers:
    0
    Trophy Points:
    155
    #5
    I have done. Thanks for help. but it was different code.
     
    hiteshb, Sep 25, 2009 IP
  6. orionoreo

    orionoreo Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    does the line work though because I'm not sure how its querying and taking a guess here....

    
    
    $days_to_query = 60;
    $days_to_ts = (3600 * 24) * $days_to_query;
    $previous_time = strtotime("now") - $days_to_ts;
    
    
    $currentdate = date("Y-m-d", $previous_time);
    
    
    PHP:
    your query has to be something like date>=$currentdate
     
    orionoreo, Sep 25, 2009 IP
  7. TheOnly92

    TheOnly92 Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    date >= $pastdate AND date <= $currentdate
    where $pastdate = time for past (for 60 days its like time() - 60 * 24 * 60 * 60) $currentdate = time()
     
    TheOnly92, Sep 25, 2009 IP