Visualizzazione dei risultati da 1 a 3 su 3

Discussione: se il file esiste

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589

    se il file esiste

    ciao m trovoin difficoltà nel scrivere il codice che verifica l esistenza del file foto e lo visualizza o no .

    premessa i file sono nella cartella : _files/group/nomefile_s.jpg e nome file sarebbe il campo id proprio.


    Codice PHP:

       
    echo "<table width=100% border=0 cellpadding=0 cellspacing=6 class=\"gr_table\">
    <tr>
    <td class=\"gr_image\"><a href=\"groups_profile.php?gid=
    $idgroup\">


     if(is_file( \"_files/group/\".
    $results['id']. \"_s.jpg\"))<img src=\"_files/group/\".$results['id']. \"_s.jpg\" border=\"0\" /></a> ;

                    else {
                                <img src=\"_files/no_group_c.gif\" border=\"0\" /></a>  ;
                    }


    </td></tr>
    "


    grazie

  2. #2

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589
    ok ho risolto cosi


    Codice PHP:

     
    echo "<table width=100% border=0 cellpadding=0 cellspacing=6 class=\"gr_table\">
    <tr>
    <td class=\"gr_image\"><a href=\"groups_profile.php?gid=
    $idgroup\"> ";

      
    $nomefile "_files/groups/".$results['id']. "_s.jpg" ;
         
    $nomefileno "_files/no_group_c.gif"  ;

    if (@
    is_file($nomefile)) {

      



           echo 
    "  <img src=$nomefile border=\"0\" ></a> ";

      
    }

       else {


                       echo 
    "  <img src=$nomefileno border=\"0\" ></a>  ";

                               
                               
                    } 
    grazie ugualmente

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 © 2024 vBulletin Solutions, Inc. All rights reserved.