[nycphp-talk] php DATE links
Daniel Convissor
danielc at analysisandsolutions.com
Mon Apr 5 11:08:37 EDT 2004
Yo Ovidiu:
On Mon, Apr 05, 2004 at 12:13:20PM +0300, Ovidiu wrote:
> will have to use if (isSet($today)) { query & display } // for today and
> another if (isSet($month)) { query for month } and another one for all
> or it a easy way without using 3 if ?
I'm not completely clear on what you're trying to do. But perhaps it's
something like this?
if (isset($today) && preg_match('\d{4}-\d{2}-\d{2}', $today)) {
$where = " WHERE date='" . $today . "'";
} elseif (isset($month) && preg_match(...similar to above...)) {
$where = " WHERE date='" . $month . "'";
} else {
$where = '';
}
$sql = 'SELECT * FROM calendar' . $where;
See you,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
More information about the talk
mailing list