Advertisement
mrsteveita

classifica.php

Jul 29th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.     $query="SELECT * FROM classifica ORDER BY Voto DESC";
  3.     $res=mysqli_query($con, $query);
  4.    
  5.     if($res && mysqli_num_rows($res)>0){
  6.         while($row=mysqli_fetch_assoc($res)){
  7.         $nome = $row['Nome']."";
  8.         $data = $row['Data']."";
  9.         $voto = $row['Voto']."";
  10.         $link = $row['Link']."";
  11.         setlocale( LC_TIME,"it_IT");
  12.         $data2 = strftime('%d %B %Y', strtotime($data));
  13.         $pos = 1;
  14.         $controllo = substr($voto, -1, 1);
  15.         $voto2 = str_replace(".0", "", $voto);
  16.        
  17.         ?>
  18.         <tr>
  19.             <td><?php echo $pos++; ?></td>
  20.             <td><strong><?php echo $nome; ?></strong></td>
  21.             <td><?php echo $data2; ?></td>
  22.             <td><strong><?php if($controllo=="0"){echo $voto2;} else {echo $voto;} ?>/10</strong></td>
  23.             <td><?php if(!$link){echo '-';} else { ?><a href="https://www.youtube.com/watch?v=<?php echo $link; ?>" target="_blank">LINK</a></td><?php } ?>
  24.         </tr>
  25.         <?php }
  26.     } else { ?>
  27.         <tr><td colspan="5">Errore!</td></tr>
  28. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement