PHP Fatal error: Call to a member function num_rows() on boolean in

Maaf ka mau tanya kalo error seperti ini itu masalahnya di mana ya? Terimakasih

PHP Fatal error:  Call to a member function num_rows() on boolean in /home/public_html/penjualan/application/models/M_barang.php on line 26

unknown.png

avatar dimassatria
@dimassatria

3 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

Tanggapan

Kode kamu sulit dibaca, coba taro di tag kode dan dirapikan agar bisa dibantu

1 Jawaban:

<pre> $data['totalData'] = $this-&gt;db-&gt;query($sql)-&gt;num_rows();

	if( ! empty($like_value))
	{
		$sql .= &quot; AND ( &quot;;    
		$sql .= &quot;
			a.`kode_barang` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR a.`nama_barang` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039;
			OR a.`size` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR IF(a.`total_stok` = 0, &#039;Kosong&#039;, a.`total_stok`) LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR CONCAT(&#039;Rp. &#039;, REPLACE(FORMAT(a.`harga`, 0),&#039;,&#039;,&#039;.&#039;) ) LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR a.`keterangan` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR b.`kategori` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
			OR c.`merk` LIKE &#039;%&quot;.$this-&amp;gt;db-&amp;gt;escape_like_str($like_value).&quot;%&#039; 
		&quot;;
		$sql .= &quot; ) &quot;;
	}&lt;/pre&gt;
avatar dimassatria
@dimassatria

3 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban