website logo
Auteur
avatar
oim

Forum » » Le coin des codeurs » » [Résolu] - function+while


Posté : 5 mars 2007 à 22:54 icone du post

Je voulais pas tout mettre !


function listpalindromeauteur($username) {global $ModPath, $ModStart, $NPDS_Prefix, $ThisFile; menuprincipal();
    Opentable();
    $rowcolor=tablos();
    
        //Pour la naviguation
        Global $start;
        !include!("modules/palindrome/pal_conf.php");
        if (empty($start)) { $start = 0; }
        
        //Total pour naviguation    
        $result = mysql_query("select count(*) from palindrome where username='$username'");
        $nbsites=0; if ($result) { $nbsites = mysql_result($result,0); }    

        echo "<table width=\"80%\" align=\"center\">\n";
            echo "<tr align=\"center\" $rowcolor>\n";
                echo "<td class=\"titre\" colspan=\"5\">".palindrome_trad("Palindrome de ")."$username</td>\n";
            echo "</tr>\n";
            echo "<tr align=\"center\" $rowcolor>\n";
                echo "<td width=\"10%\">".palindrome_trad("Membre")."</td>\n";
                echo "<td width=\"60%\">".palindrome_trad("Phrase")."</td>\n";
                echo "<td width=\"10%\">".palindrome_trad("Statut")."</td>\n";
                echo "<td width=\"5%\">".palindrome_trad("Editer")."</td>\n";
                echo "<td width=\"10%\">".palindrome_trad("Supprimer")."</td>\n";
            echo "</tr>\n";

                $query = mysql_query("select * from ".$NPDS_Prefix."palindrome where username='$username' LIMIT ".    $start.",".$nb_news."");
                while (list($id,$phrase,$username,$en_ligne)=mysql_fetch_array($query)) {
                    
            echo "<tr $rowcolor>\n";
                echo "<td width=\"10%\" align=\"center\">$username</td>\n";
                echo "<td width=\"60%\">$phrase</td>\n";
                echo "<td width=\"5%\" align=\"center\">$en_ligne</td>\n";
                echo "<td align=\"center\" width=\"5%\"><a href=".$ThisFile."&subop=editpalindromeauteur&id=$id&username=$username><img src=modules/palindrome/images/editer.gif border=\"0\"></a></td>\n";  
   echo "<td align=\"center\" width=\"10%\"><a href=".$ThisFile."&subop=suppripalauteur&id=$id&username=$username><img src=modules/palindrome/images/delete.gif border=\"0\"></a></td>\n";
            echo "</tr>\n"; }
        echo "</table>\n";

        //Naviguation
        echo "<br><table width=\"100%\" cellpadding=\"0\" cellspacing=\"3\" border=\"0\">\n";
            echo "<tr>\n";
                echo "<td align=\"left\"><span class=\"rouge\">"; $nombre=ceil($nbsites/$nb_news);
                    echo "".palindrome_trad("Page")." ".(($start/$nb_news)+1)." ".palindrome_trad("sur")." ".$nombre."</span>  ";
                    if($nombre>1) {
                    for($i=1; $i<=$nombre; $i++) {
                    $test = (($start/$nb_news)+1);
                    if ($i==$test) {
                    echo "[$i] "; } else {
                    echo "[<a href=\"".$ThisFile."&subop=listpalindromeauteur&username=$username&start=".(($i-1)*$nb_news)."\">$i</a>] ";
                    }
                    }
                    }
                echo "</td>\n";
            echo "</tr>\n";
        echo "</table>\n";
        
    Closetable();
}


Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=22040&forum=5