MySQL Forums
Forum List  »  PHP

Month events!!
Posted by: Paulo Monteiro
Date: May 04, 2006 09:51AM

I have the next code:

function trata_month($mes) {
  $months = array("", "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro");
  return $months[$mes];
}


[PHP]
<?
$conn = mysql_connect(SERVER,DBUSER,DBPWD) or die ("Problemas na ligação MySQL");
mysql_select_db (DB);
$modifier = isset($_GET['modifier']) ? mysql_real_escape_string($_GET['modifier'], $conn) : 0;
$sql = "select * from agenda_geral where agenda='desporto' and month = month(now()) + ".$modifier." and area_ID = 1 order by day" ;
$queryl = query($sql) or die ("Query failed: " . mysql_error() . " Actual query: " . $sql);
$contal = mysql_num_rows($queryl);

.......


<p>
<?php for($i=-3;$i<2;$i++) { ?>
<a href="agend_desporto.php?modifier=<?php echo($i); ?>"><?php echo(trata_month($arrl["month"]+$i)); ?></a><br />
<?php } ?>
</p>[/PHP]


Resume output:

http://10.0.0.9/cm-lousa.pt/2.0/agen...php?modifier=0

Fevereiro
Março
Abril
Maio
Junho


http://10.0.0.9/cm-lousa.pt/2.0/agen...hp?modifier=-1

Janeiro
Fevereiro
Março
Abril
Maio

In this case, if I click in Abril, it goes to Maio
If i click in Fevereiro, it goes to Março and shows:

Janeiro
Fevereiro
Março
Abril

and so on.

Did you understand the problem?!!

Options: ReplyQuote


Subject
Written By
Posted
Month events!!
May 04, 2006 09:51AM
May 04, 2006 10:14AM
May 04, 2006 10:46AM
May 04, 2006 11:32AM
May 04, 2006 11:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.