PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Nov 24, 2014 2:54 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Sep 03, 2012 11:28 pm 
Offline
Forum Contributor
User avatar

Joined: Mon Jan 02, 2012 10:20 am
Posts: 165
Location: MP
Hi all,

I am doing some search in which my requirment is to search between specific dates.
Like user can put start date and then end date. Once submit then it should find result between these two dates but how ever how can avoid not to show the empty end date value?


Last edited by jayson.ph on Fri Sep 07, 2012 4:53 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Sep 04, 2012 2:37 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 5647
Location: WA, USA
So only a start date?
Code:
if ($start and $end dates) {
    date condition = "date field BETWEEN $start AND $end";
} else if (only $start) {
    date condition = "date field >= $start";
} else { // only $end
    date condition = "date field <= $end";
}

query = "SELECT ... WHERE $date condition";


Top
 Profile  
 
PostPosted: Fri Sep 07, 2012 4:53 am 
Offline
Forum Contributor
User avatar

Joined: Mon Jan 02, 2012 10:20 am
Posts: 165
Location: MP
Thank you requinix-


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group