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
https://forums.phpfreaks.com/topic/36575-how-can-i-do-this-please-help/
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.

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'

Archived

This topic is now archived and is closed to further replies.

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