Uncaught Error: Call to undefined function mysql_result()

Selamat Pagi.. Ijin bertanya suhu.. Ane lagi Belajar nampilin data dihalaman pake php nih suhu, ane dapet error ini pesan erorr nya " Uncaught Error: Call to undefined function mysql_result()" nah ane belum ngerticaranyelesaiin nya :P Mohon bantuannya suhu :)

 <!DOCTYPE html>
<html>
<head><title>File Politik</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

<?php
  include 'koneksi.php';

  $tabel1 = 'isiberita';
  $tabel2 = 'kategori';
  $id=1;

  $hal = $_GET['hal']; //*line 15 errornya : Notice: Undefined index: hal
  //validasi halaman
  if (!isset($_GET['hal'])) {
          $page = 1;
  } else {
    $page = $_GET['hal'];
  }
  //data tampil perhalaman
  $max_result = 2;

  $from = (($page * $max_result) - $max_result);

  //query tampil perhalaman
  $sql=$conn->query("SELECT * FROM  $tabel1,$tabel2 where $tabel1.id_kategori=$id and $tabel1.id_kategori=$tabel2.id_kategori
                    ORDER BY tanggal DESC LIMIT $from,$max_result");
while ($tampil = $sql->fetch(PDO::FETCH_ASSOC))
{

      $data = substr($tampil['isi'],0,200);
      echo "<div class='box'>";
      echo "<p align='justify'>";
      echo "<img class='gambar' src='$tampil[gambar]' width=150px height=150px align='left' />";
      echo "<font valign='top'>";
      echo "<strong>";
      echo $tampil['judul'];
      echo "</strong>";
      echo $data;

      echo "<a href='index.php?menu=detail_politik&id==$tampil[id_berita]'>  baca lengkap>>>></a>";
      echo "</font></p></div><br>";
}

//total
$total_result = mysql_result(mysql_query("SELECT count(*) as Num From $tabel1 where $tabel1.id_kategori=$id"),0); // ane udh coba ganti : "$total_result = $conn->query("SELECT count(*) as Num From $tabel1 where $tabel1.id_kategori=$id");" peran errornya : Notice: Object of class PDOStatement could not be converted to int.

$total_pages = ceil($total_result / $max_result);

echo "<center> piliih Halaman <br />";
//proses link
if ($hal > 1) {
  $prev = ($page - 1);
  echo "<a href=$_SERVER[PHP_SELF]?menu=politik&hal$prev>
        <-Sebelumnya </a>";
}

//link daftar urutan Halaman
for ($i=1; $i <= $total_pages; $i++) {
        if (($hal)==$i) {
          echo "$i";
        } else {
          echo "<a href=$_SERVER[PHP_SELF]?menu=politik&hal=$i>$i</a>";
        }
      }
        //link halaman selanjutnya
        if ($hal < $total_pages) {
          $next = ($page + 1);
          echo "<a href=$_SERVER[PHP_SELF]?menu=politik&hal=$next>Selanjutnya-></a>";
        }

      echo "</center>";

?>
</body>
</html>


ini outputnya :

avatar Arfa
@Arfa

17 Kontribusi 1 Poin

Dipost 6 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban