Results 1 to 3 of 3

Thread: month events...

  1. #1
    Join Date
    Apr 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question month events...

    If I have:


    PHP Code:
    ...
    $sql "select * from agenda_geral where agenda='desporto' and Bmonth = (month(now())+1) + ".$modifier." and area_ID = 1 order by Bday" ;
                        
    $queryl query($sql) or die ("Query failed: " mysql_error() . " Actual query: " $sql);
                      
    $contal mysql_num_rows($queryl);
                   
                    
                for (
    $j=0$j<1;$j++)
                {
                    
    $arrl mysql_fetch_array($queryl);... 
    and I want if there aren't no events in the next month the link not appears. What should I do in the next code?

    PHP Code:
    <? if( $arrl["Bmonth"] == NULL) {?>
                                <a></a>
                          <? } else { ?>
                                  | <a href="agend_desporto.php?modifier=1"> Seguinte </a> 
                          <? ?>
    Last edited by pavmoxo; 05-16-2006 at 02:04 PM.

  2. #2
    Join Date
    May 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well you would not test for a NULL value:

    Code:
    <? if( $arrl["Bmonth"] == NULL) {?>
    You would test for nothing...But all we need to do is test for the true value, a month:

    Code:
    <? if( $arrl["Bmonth"] ) {?>
    | <a href="agend_desporto.php?modifier=1"> Seguinte </a>
    <?php
    }
    Have fun

  3. #3
    Join Date
    Apr 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    But i don't understand what it's happen!!

    Bmonth = month(now()) in my querie but I wan't to verify if exists a register in the next month in DB for show the word "Seguinte". I don&#180;t know what to do more.

    Code:

    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;
                    
    $day date(d);
                    if(
    $day 25)
                            
    $sql "select * from agenda_geral where agenda='desporto' and Bmonth = month(now()) + ".$modifier." and area_ID = 1 order by Bday" ;
                    else
                            
    $sql "select * from agenda_geral where agenda='desporto' and Bmonth = (month(now())+1) + ".$modifier." and area_ID = 1 order by Bday" ;
                        
    $queryl query($sql) or die ("Query failed: " mysql_error() . " Actual query: " $sql);
                      
    $contal mysql_num_rows($queryl);
                   
                    
                for (
    $j=0$j<1;$j++)
                {
                    
    $arrl mysql_fetch_array($queryl);
                
    ?>            
           <h1>Desporto - <? echo trata_month($arrl["Bmonth"])." de ".$arrl["Byear"]; ?></h1>
           
           
           <!-- ALTERNATIVA-->
              <p>
                    <? if($modifier == -1) {?>
                          <a href="agend_desporto.php?modifier=0"> Actual </a> 
                        <?
                             $next_month
    $arrl["Bmonth"];
                           echo 
    $next_month;
                           
                           if(
    $arrl["Bmonth"]) {?>
                                | <a href="agend_desporto.php?modifier=1"> Seguinte </a> 
                          <? ?>
                                  
                        
                  <? 
                  

                  elseif(
    $modifier == 0
                  {
                  
    ?>
                          <a href="agend_desporto.php?modifier=-1"> Anterior </a> | 
                          <a href="agend_desporto.php?modifier=0"> Actual </a> 
                          <?
                           $next_month
    $arrl["Bmonth"];
                           echo 
    $next_month;
                           if(
    $arrl["Bmonth"]) {?>
                                | <a href="agend_desporto.php?modifier=1"> Seguinte </a> 
                          <? ?>
                  <? }
                  elseif(
    $modifier == 1)
                  {
                  
    ?>
                        <a href="agend_desporto.php?modifier=-1"> Anterior </a> | 
                      <a href="agend_desporto.php?modifier=0"> Actual </a> 
                  <? ?>
                  
                  
              </p>
              <? ?>

Bookmarks

Posting Permissions

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