Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    868

    mysql query question

    Hello ,
    i want to select records from start till 6 hours ago

    fieldname : date
    type : datetime


    i tried following but is not working
    PHP Code:
    $today=date('Y-m-d H:i:s');
    $date=strtotime($today);
    $date=strtotime("-6 hours",$date);
    $date=date('Y-m-d H:i:s'$date);

    $sql"Select fields from table where date < '$date'"

  2. #2
    Join Date
    Apr 2003
    Location
    Los Angeles, CA
    Posts
    800
    Try: SELECT fields FROM table WHERE date<NOW() - INTERVAL 6 HOUR
    Pings <1 ms, Unlimited Transfer, Lowest Price: http://localhost/

  3. #3
    Join Date
    Jul 2004
    Posts
    868
    thank you !

Posting Permissions

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