Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Month events!!

  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    154
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Month events!!

    I have the next code:

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

    PHP Code:
     <?
    $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>

    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?!!

  • #2
    Regular Coder
    Join Date
    Feb 2006
    Location
    The Netherlands
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure if I understand the code, but have you tried manually setting the keys for the months? (assuming it are months)
    Yeah that.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •