Trying to get property 'num_rows' of non-object in xampp baris 115 pada bagian

<html>
    <head>
    <title>Form Entry Data Buku</title>
	<body>
<img align="center" src="el.jpg"width=12% height=13%>
<left><h5>SISTEM  PEMINJAMAN BUKU</h5>
<h5>El-Jannah Lib</h5>
<center><h2>ENTRY DATA BUKU</h2>
</body>
<style>
a, button,input[type=submit],input[type=reset] {
    font-family: sans-serif;
    font-size: 15px;
    background: #22a4cf;
    color: white;
    border: white 3px solid;
    border-radius: 5px;
    padding: 12px 20px;
    margin-top: 10px;
}
a {
    text-decoration: none;
}
a:hover, button:hover, input[type=submit]:hover, input[type=reset]:hover{
    opacity:0.9;
}
</style>
    </head>

	<html>
<head>
	<meta charset="utf8mb4_general_ci">
	<title>Style Tag Fieldset</title>
	<style >
		fieldset{
			width: 500px; /* lebar */
			border-color: blue; /* warna garis tepi */
			box-shadow: 6px 6px 10px #333; /* bayangan */
			margin-right: 488px;
			margin-left: 488px;

		}
	</style>

	<?php
include "dua.php";

		$kodebuku="";
		$judulbuku="";
		$pengarang="";
		$penerbit="";
		$tempatterbit="";
		$jumlahcopy="";
		if(isset($_REQUEST['edit'])){
			$a = $_REQUEST['edit'];
			$mysqli = "select * from perpus where kodebuku = $a ";
			$result = mysqli_query($conn, $mysqli);
			while($row = $result->fetch_assoc()){
				extract($row, EXTR_OVERWRITE, "dup");
			}
		}

?>

<body align=center>
  <form method="post" action="tigabuku.php">

  <?php

if(isset($_REQUEST['edit'])){
	echo '<input type="show" name="edit" kodebuku="edit" value="'.$_REQUEST['edit'].'" /> ';
}
?>

  	 <fieldset >
		<legend align=center><font color="#000080"><b>Data Buku</b></font></legend>
		</br>
		</br>
		<label>kodebuku</label>
		<input type="text" name="kodebuku" placeholder="Input kodebuku" value="<?php echo $kodebuku;?>">
		</br>
		</br>
		<label>judulbuku</label>
		<input type="text" name="judulbuku" placeholder="Input judulbuku" value="<?php echo $judulbuku;?>">
		</br>
		</br>
		<label>pengarang</label>
		<input type="text" name="pengarang" placeholder="Input pengarang" value="<?php echo $pengarang;?>">
		</br>
		</br>
		<label>penerbit</label>
		<input type="text" name="penerbit" placeholder="Input penerbit" value="<?php echo $penerbit;?>">
		</br>
		</br>
		<label>tempatterbit</label>
		<input type="text" name="tempatterbit" placeholder="Input tempatterbit" value="<?php echo $tempatterbit;?>">
		</br>
		</br>
		<label>jumlahcopy</label>
		<input type="text" name="jumlahcopy" placeholder="Input jumlahcopy" value="<?php echo $jumlahcopy;?>">
		</br>
		</br>
   </tbody></table>
    <input type="reset" value="Kembali" /><input type="reset" value="Hapus" /><input type="submit" value="Simpan" />
		</fieldset>
 	 </form>
</body>
</br>
</br>
</br>
<?php
include "dua.php";
$mysqli = "select * from perpus";
  $result = mysqli_query($conn, $mysqli);
  if ($result->num_rows > 0) {
	  ?>
	  <table border="1" align="center" cellpadding="20">
        <tr bgcolor="LIGHTBLUE">
            <td><B>No. Urut</td></B>
            <td><B>kodebuku</td></B>
			<td><B>judulbuku</td></B>
			<td><B>pengarang</td></B>
			<td><B>penerbit</td></B>
			<td><B>tempatterbit</td></B>
			<td><B>jumlahcopy</td></B>
			<td><B>aksi</td></B>
        </tr>


	  <?php

	  if(isset($_REQUEST['hapus'])){
			$a = $_REQUEST['hapus'];
			$sql = "DELETE FROM perpus WHERE kodebuku=$a";
			//echo $sql;
			if ($conn->query($sql) === TRUE) {
			  echo "Data berhasil dihapus";
			} else {
			  echo "Error menghapus data: " . $conn->error;
			}
		}

	  $urut = 1;
	  while($row = $result->fetch_assoc()) {
		extract($row, EXTR_OVERWRITE , "dup");
		echo "        <tr>
            <td>$urut</td>
            <td>$kodebuku</td>
			<td>$judulbuku</td>
			<td>$pengarang</td>
			<td>$penerbit</td>
			<td>$tempatterbit</td>
			<td>$jumlahcopy</td>
			<td><a href='satubuku.php?hapus=$kodebuku'  onclick=\"return confirm('Anda yakin ingin menghapus data ini?');\">Hapus</a> | <a href='satubuku.php?edit=$kodebuku'>Edit</a></td>

        </tr>";
		$urut++;
	  }
	  echo "</table>";
	} else {
	  echo "Tidak ada data";
	}
?>
avatar Anfile
@Anfile

2 Kontribusi 0 Poin

Dipost 2 tahun yang lalu

1 Jawaban:

<pre>&lt;?php include "dua.php"; $mysqli = "select * from perpus"; $result = mysqli_query($conn, $mysqli); if ($result-&gt;num_rows &gt; 0) { ?&gt;</pre>

avatar Anfile
@Anfile

2 Kontribusi 0 Poin

Dipost 2 tahun yang lalu

Login untuk ikut Jawaban