Re: mysql + $_GET

From: Date: Tue, 08 Apr 2003 09:20:28 +0000
Subject: Re: mysql + $_GET
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142823@lists.php.net to get a copy of this message
On Tuesday 08 April 2003 12:04, Sebastian wrote: > I have a URL that looks like this: month=April&year=2003 > > in mysql the time stamp is unix format, and i want to select rows based on > the URL. If you're using MySQL's TIMESTAMP format then it is YYYYMMDD... In which case you simply do something like: SELECT * FROM news WHERE time LIKE '{$_GET['year']}{$_GET['month']}%' If the dates really are unix timestamps then it gets a bit more complicated. You could get the unix-timestamp of the year/month ($A) in question and also that of the following month ($B) then: SELECT * FROM news WHERE time BETWEEN $A AND $B -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* We do not colonize. We conquer. We rule. There is no other way for us. -- Rojan, "By Any Other Name", stardate 4657.5 */

« previous php.general (#142823) next »