PHP] date() and mktime() functions:
> weeknumbers and months.
>
>
> On Monday 31 March 2003 22:07, Davy Obdam wrote:
>
> > I would like to select news from my database bases on week/year and
> > month/year. How can i do this.. I would like to pass two
> arguments in
On Monday 31 March 2003 22:07, Davy Obdam wrote:
> I would like to select news from my database bases on week/year and
> month/year.
> How can i do this.. I would like to pass two arguments in the query
> string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
> Can anybody help me.
Check out mysql manual, section 6.3.4 - Date and Time Functions, example
$condition='';
if($GET['week']) $condition .= "WEEK(date)='$_GET[week]' AND ";
if($GET['year']) $condition .= "YEAR(date)='$_GET[week]' AND ";
and so on
then use the condition:
$sql = "SELECT * FROM news WHERE $condition 1";
3 matches
Mail list logo