Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Problema agenda

  1. #1

    Problema agenda

    Allora ragazzi io ho questo problema qua, ho un calendario, che se nel db c'è inserito tre appuntamenti per tre fasce orari, diventa rosso, e nn ci sono problemi, poi ho fatto in modo che quando il giorno è libero, dovrebbe mettermi un link in modo che si possa prenotare. Il problema è che non riesco a dirgli che solo se le tre fasce sono complete deve mettermi rosso e non linkabile, mentre se anche un solo orario è libero deve mettermi il numeretto con link, ma quest' ultima parte non funge, ecco il codice.

    Codice PHP:
    <?php
    function ShowCalendar($m,$y)
    {
      if ((!isset(
    $_GET['d']))||($_GET['d'] == ""))
      {
        
    $m $m;
        
    $y $y;
      }else{
        
    $m = (int)@strftime"%m" ,(int)$_GET['d']);
        
    $y = (int)@strftime"%Y" ,(int)$_GET['d']);
        
    $m $m;
        
    $y $y;
      }

      
    $precedente = @mktime(000$m -11$y);
      
    $successivo = @mktime(000$m +11$y);

      
    $nomi_mesi = array("",
        
    "Gen",
        
    "Feb",
        
    "Mar",
        
    "Apr",
        
    "Mag",
        
    "Giu",
        
    "Lug",
        
    "Ago",
        
    "Set",
        
    "Ott",
        
    "Nov",
        
    "Dic"
      
    );

      
    $nomi_giorni = array(
        
    "Lun",
        
    "Mar",
        
    "Mer",
        
    "Gio",
        
    "Ven",
        
    "Sab",
        
    "Dom"
      
    );

      
    $cols 7;
      
    $days = @date("t",@mktime(000$m1$y)); 
      
    $lunedi= @date("w",@mktime(000$m1$y));
      if(
    $lunedi==0$lunedi 7;

      echo 
    "<table>\n"
      echo 
    "<tr>\n
      <td class='testo' colspan=\""
    .$cols."\">
      <a href=\"?d=" 
    $precedente "\">&lt;&lt;</a>
      " 
    $nomi_mesi[$m] . " " $y 
      <a href=\"?d=" 
    $successivo "\">&gt;&gt;</a></td></tr>";
      foreach(
    $nomi_giorni as $v)
      {
        echo 
    "<td class='testo'>[b]".$v."[/b]</td>\n";
      }
      echo 
    "</tr>";

      for(
    $j 1$j<$days+$lunedi$j++)
      {
        if(
    $j%$cols+1==0)
        {
          echo 
    "<tr>\n";
        }

        if(
    $j<$lunedi)
        {
          echo 
    "<td> </td>\n";
        }else{
          
    $day$j-($lunedi-1);
          
    $data = @strtotime(@date($y."-".$m."-".$day));
          
          
    $oggi = @strtotime(@date("Y-m-d"));
          @include 
    'config.php';
          
    $sql "SELECT str_data, prima, seconda , terza FROM ortobotanico";
          
    $result = @mysql_query($sql) or die (mysql_error());
          if(@
    mysql_num_rows($result) > 0)
          
          {
            while(
    $fetch = @mysql_fetch_array($result))
            {
              
    $str_data $fetch['str_data'];
              
    $prima $fetch['prima'];
              
    $seconda $fetch['seconda'];
          
    $terza $fetch['terza'];
            if (
    $str_data == $data && $prima == 'Completo' && $seconda == 'Completo' && $terza == 'Completo' )
            
              
              {
              
                
    $day "<font class='numeri'>$day</font>";
                 
              }     
               elseif (
    $str_data != $data && $prima != 'Completo' && $seconda != 'Completo' && $terza != 'Completo' )
           {
              
                
    $day "[url='#']$day[/url]";
                 
              }
              
            } 

          } 

         
        
          if(
    $data != $oggi)
          {
            echo 
    "<td><font class='testo'>".$day."</font></td>";
          }else{
            echo 
    "<td><font class='testo'>[b]".$day."[/b]</font></td>";
          }
        }

        if(
    $j%$cols==0)
        {
          echo 
    "</tr>";
        }
      }
      echo 
    "<tr></tr>";
      echo 
    "</table>";
    }

    @
    mysql_close();
    @
    ShowCalendar(@date("n"),@date("Y"));
     
    ?>

    La parte che praticamente nn funziona è questa


    Codice PHP:
       $day$j-($lunedi-1);
          
    $data = @strtotime(@date($y."-".$m."-".$day));
          
          
    $oggi = @strtotime(@date("Y-m-d"));
          @include 
    'config.php';
          
    $sql "SELECT str_data, prima, seconda , terza FROM ortobotanico";
          
    $result = @mysql_query($sql) or die (mysql_error());
          if(@
    mysql_num_rows($result) > 0)
          
          {
            while(
    $fetch = @mysql_fetch_array($result))
            {
              
    $str_data $fetch['str_data'];
              
    $prima $fetch['prima'];
              
    $seconda $fetch['seconda'];
          
    $terza $fetch['terza'];
            if (
    $str_data == $data && $prima == 'Completo' && $seconda == 'Completo' && $terza == 'Completo' )
            
              
              {
              
                
    $day "<font class='numeri'>$day</font>";
                 
              }     
               elseif (
    $str_data != $data && $prima != 'Completo' && $seconda != 'Completo' && $terza != 'Completo' )
           {
              
                
    $day "[url='#']$day[/url]";
                 
              }
              
            } 

          } 

    Non riesco a capire pekke , come devo fare?

  2. #2
    Nessuno mi può aiutare?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.