select and date range

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

select and date range

Post 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);
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: select and date range

Post by requinix »

You mean the date field is a string type? Like VARCHAR? That needs to change to a DATETIME. Then it's easy.
Post Reply