Jump to content

How Can I Do This, Please Help


just me and php

Recommended Posts

This Works But Echo's All Dates Posted And I Only Want 2 Weeks Between Dates

$start = strtotime("01/27/07 23:59:59");
$end  = strtotime("02/11/07 23:59:59");

$p_id1 = 'Danger Zone';

$query = "SELECT DATE_FORMAT(date, '%h:%i %p') AS time, recno,disp,track,Username,MAX(date) AS date,online, MIN(HL_MS) AS HL_MS,reshack,hacked FROM NatHotLap WHERE track= '$p_id1' GROUP BY 'disp','online','Username','track'  ORDER BY 'HL_MS' ASC  
";

 

This One Below Doesnt Work Because Of WHERE date BETWEEN '$start' AND '$end ',track= '$p_id1'

How Can I Make This Work???

date and track are rows in my table

 


$start = strtotime("01/27/07 23:59:59");
$end  = strtotime("02/11/07 23:59:59");

$p_id1 = 'Danger Zone';

$query = "SELECT DATE_FORMAT(date, '%h:%i %p') AS time, recno,disp,track,Username,MAX(date) AS date,online, MIN(HL_MS) AS HL_MS,reshack,hacked FROM NatHotLap WHERE date BETWEEN '$start' AND '$end ',track= '$p_id1' GROUP BY 'disp','online','Username','track'  ORDER BY 'HL_MS' ASC  
";

Link to comment
Share on other sites

It is possible to use syntax like this:

"SELECT * FROM table WHERE field > '2007-01-27 23:59:59' AND field < '2007-02-11 23:59:59'";

Just format your strings the same as the mysql datetime field and this should work.

 

Plus what poco said.

Link to comment
Share on other sites

thanks i changed date row in table to tbldate and this WHERE tbldate > '01/27/07 23:59:59' AND tbldate < '02/11/07 23:59:59' and it posted all data in the date time i wanted.

 

but i also need it to post this WHERE track= '$p_id1' how can i add that in the WHERE tbldate > '01/27/07 23:59:59' AND tbldate < '02/11/07 23:59:59'

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.