Advertisement
cdsatrian

jumlah komentar

Apr 10th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <link rel="stylesheet" type="text/css" href="css/style.css">
  2. <?php
  3. include'koneksi.php';
  4. $sql=mysql_query(" SELECT a.*, SUM(IF(ISNULL(b.id_berita),0,1)) AS jml
  5.                   FROM isi_berita a
  6.                   LEFT JOIN komentar b ON b.id_berita=a.id_berita
  7.                   GROUP BY b.id_berita
  8.                   ORDER BY a.tanggal DESC LIMIT 3");
  9. while($tampil=mysql_fetch_array($sql)){
  10. ?>
  11. <div class="box">
  12.     <font valign="top">
  13.        <a href="detail_headline.php?menu=detail_headline&id=<?=$tampil['id_berita']; ?>">
  14.            <font style='font-size: 16px; font-weight: bold;'>
  15.             <?php echo $tampil['judul']; ?>
  16.            </font>
  17.         </a>
  18.         <br>
  19.         <font size='2px' color='gray' style='line-height: 28px; font-size: 11px;'>
  20.           <img src='gambar/user.png' style='width: 9px; height: 9px; margin:0; border: none; line-height: 28px;' />
  21.           Berita Upload
  22.           <img src='gambar/time.png' style='width: 9px; height: 9px; margin:0; border: none; line-height: 28px;' />
  23.           tanggal
  24.           <?=$tampil['tanggal'];?> dengan <?=$tampil['jml'];?> komentar
  25.           </font>
  26.         <br>
  27.         <img src="<?=$tampil['gambar'];?>" align="left" />
  28.         <?php echo substr($tampil['isi'],0,200); ?>
  29.         <br></br>
  30.         <a href="detail_headline.php?menu=detail_headline&id=<?=$tampil['id_berita']; ?>" class='bacaselengkapnya'>Baca selengkapnya >></a>
  31.      </font>
  32. </div>
  33. <br>
  34. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement