Jump to content

[SOLVED] MySQL Between....


suttercain

Recommended Posts

Hi guys,

 

I am trying to select BETWEEN two dates:

 

<?php
$date1 = mysql_real_escape_string($_GET['input9']);
$date2 = mysql_real_escape_string($_GET['input10']);
echo $date1 ." & ". $date2;
$query = mysql_query("SELECT * FROM canada WHERE letter_requested BETWEEN $date1 AND $date2") or die (mysql_error());
while($row = mysql_fetch_array($query)) {
echo $row['first_name'];
}
?>

 

I am not getting any out put. But if I run just "SELECT * FROM canada" I do get the out put. Am i using the BETWEEN correctly?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/60287-solved-mysql-between/
Share on other sites

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.