0
$datef = (date("Y-m-d",mktime(0, 0, 0, $_GET['year'], $_GET['month'], $_GET['day'])));
		$datel = (date("Y-m-d",mktime(0, 0, 0, $_GET['year1'], $_GET['month1'], $_GET['day1'])));
		echo $datef.$datel;
		$result = mysql_query("SELECT f8_0, n7_91, t_stamp FROM westdrayton WHERE t_stamp BETWEEN '".$datef."' AND '".$datel."' limit 20");

I have this PHP code to try and grab records from between the two dates in a mysql db. In the database i'm just timestamping every record that comes in.

Any one spot why this code wouldnt work?

Thanks

5
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by monica singh
0

I think your error is with your date variables:

$datef = date("Y-m-d",mktime(0, 0, 0, $_GET['year'], $_GET['month'], $_GET['day']));
$datel = date("Y-m-d",mktime(0, 0, 0, $_GET['year1'], $_GET['month1'], $_GET['day1']));

Are you getting any error messages or is it just not grabbing anything from the database? I've just made a guess at what could be wrong since I don't know if you're getting any type of error message.

0

This worked in the end!

$datef = (date("Y-m-d",mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year'])));
				$datel = (date("Y-m-d",mktime(0, 0, 0, $_POST['month1'], $_POST['day1'], $_POST['year1'])));
				$result = mysql_query("SELECT f8_0, n7_91, t_stamp FROM `westdrayton` WHERE t_stamp BETWEEN '".$datef."' AND '".$datel."'");
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.