Page 1 of 1

select and date range

Posted: Wed Apr 02, 2014 4:56 am
by jonnyfortis
I need to select a date range between two dates

the dates I am currently filtering are just 2014 but i need to show a date range

any date from 01/02/13 until 01/31/2014

date are stored as Sep 12 2012 15:43:08

my sql is currently

Code: Select all

mysql_select_db($database_hostprop, $hostprop);
$query_rsPayment = "SELECT * FROM host_payments, plus_signup, host_editprop WHERE host_payments.payment_created_timestamp LIKE '%2014%' AND plus_signup.userid = host_payments.payment_userid AND host_editprop.prop_id = plus_signup.prop_id AND plus_signup.userid !='page3' ORDER BY host_payments.payment_id DESC";
$rsPayment = mysql_query($query_rsPayment, $hostprop) or die(mysql_error());
$row_rsPayment = mysql_fetch_assoc($rsPayment);
$totalRows_rsPayment = mysql_num_rows($rsPayment);

Re: select and date range

Posted: Wed Apr 02, 2014 12:43 pm
by requinix
You mean the date field is a string type? Like VARCHAR? That needs to change to a DATETIME. Then it's easy.