警告:mysqli_num_rows()要求参数1为mysqli_result,第20行和第24行(目录)中给出的布尔值为[duplicate] [英] Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in (directory) on line 20 and line 24 [duplicate]
问题描述
我制作了一个PHP脚本,但错误:
警告:mysqli_num_rows()要求参数1为mysqli_result,在C:\ xampp \ htdocs中给出布尔值第20行\ NVCL \gallery_view.php
或
警告:mysqli_num_rows()预计参数1被mysqli_result,在C定的boolean:\xampp\htdocs\NVCL\gallery_view.php上线24 MAAF,数据dengan kriteria INI tidak ditemukan
这是我的代码:
<?php
session_start();
?>
<? php
include(< span class =code-string> includes / query.php);
function format_rupiah($ angka){
$ rupiah = number_format($ angka,0,' ,',' 。');
return $ rupiah ;
}
$ query = $ _SESSION [' query_gallery'跨度>];
?>
<? php
$ limit_data = 30 ;
$ halaman = $ _ GET [ h];
if(empty($ halaman)){
$ halaman = 1;
}
$ posisi =($ halaman-1)* $ limit_data;
$ data_page = query($ query);
$ jumlah_data_page = mysqli_num_rows($ data_page);
<跨度类= 代码sdkkeyword> $ jumlah_page 跨度> =小区($ jumlah_data_page / $ limit_data);
$ query = $ query。 LIMIT $ posisi,$ limit_data;
$ data = query($ query);
if(mysqli_num_rows($ data)== 0){
echo
< div style = font-size:14px >
Maaf,data dengan kriteria ini tidak ditemukan!
< / div>
;
}
其他 {
?>
< ul class = thumb >
<? php
while($ baris = mysqli_fetch_array($ data)){
echo
< li>< a href = movie_item.php?id = $ baris [id_dvd] >< / a> ;< / li>
;
}
?>
< / ul >
< div id = clear > < / div >
<? php
if(mysqli_num_rows($ data)!= 0 &&& $ jumlah_page > 1){
?>
< div style 跨度> = padding-left:11px; padding-bottom:10px; padding-top:0px >
< br >
< 输入 type = 按钮 值 = 上一页 onclick = showGallery(<?php $ prev = $ halaman-1; if($ halaman> 1)echo $ prev; else echo1; ? < span class =code-keyword>> )>
<? php
$ tot = 7 跨度>;
if($ halaman% $ tot == 0) $ awal =($ halaman- $ TOT);
else $ awal =($ halaman - ($ halaman%$ tot));
$ akhir = $ awal + $ tot - 1 ;
if($ halaman> $ tot){
$ page_string = < span class =code-string>< input type ='button'value ='...'onclick = \showGallery($ awal- $ tot + 1)\>;
} else {
$ page_string = 跨度>;
}
for($ i =($ awal); $ i< =($ akhir); $ i ++){
$ btn = $ i + 1;
if($ i>($ jumlah_page-1)) break ;
if($ halaman == $ btn){
$ disabled = disabled跨度>;
} else {
$ disabled = ;
}
if($ btn == $ jumlah_page) continue ;
$ page_string。= < input type ='button'value ='$ btn'onclick = \\ \\showGallery($ btn)\$ disabled>;
}
if(($ jumlah_page- $ awal)> $ tot){
$ page_string。= < input type ='button'value ='...'onclick = \showGallery($ awal + $ tot + 1)\>;
}
if($ halaman == $ jumlah_page)$ last = 禁用跨度>;
else $ last = 跨度>;
$ page_string。= < input type ='button'value ='$ jumlah_page'onclick = \\ \\showGallery($ jumlah_page)\$ last>;
echo $ page_string 跨度>;
?>
< / div >
< ;? php
}
}
?>
我尝试了什么:
我试图遵循此代码错误警告:mysqli_num_rows( )期望参数1为mysqli_result,第20行和第24行(重复)
>
rupiah = number_format(
angka,0,' ,' ,' 。');
return
I make a PHP script but error :
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\NVCL\gallery_view.php on line 20
or
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\NVCL\gallery_view.php on line 24 Maaf, data dengan kriteria ini tidak ditemukan !
This is my code:
<?php
session_start();
?>
<?php
include("includes/query.php");
function format_rupiah($angka){
$rupiah=number_format($angka,0,',','.');
return $rupiah;
}
$query = $_SESSION['query_gallery'];
?>
<?php
$limit_data = 30;
$halaman=$_GET["h"];
if(empty($halaman)){
$halaman=1;
}
$posisi = ($halaman-1)*$limit_data;
$data_page = query($query);
$jumlah_data_page = mysqli_num_rows($data_page);
$jumlah_page = ceil($jumlah_data_page/$limit_data);
$query = $query." LIMIT $posisi, $limit_data";
$data = query($query);
if(mysqli_num_rows($data) == 0) {
echo "
<div style="font-size: 14px">
Maaf, data dengan kriteria ini tidak ditemukan !
</div>
";
}
else {
?>
<ul class="thumb">
<?php
while($baris = mysqli_fetch_array($data)) {
echo "
<li><a href="movie_item.php?id=$baris[id_dvd]"></a></li>
";
}
?>
</ul>
<div id="clear"></div>
<?php
if(mysqli_num_rows($data) != 0 && $jumlah_page > 1) {
?>
<div style="padding-left: 11px; padding-bottom: 10px; padding-top: 0px">
<br>
<input type="button" value="Prev" onclick="showGallery(<?php $prev=$halaman-1; if($halaman>1)echo"$prev";else echo"1"; ?>)">
<?php
$tot = 7;
if($halaman % $tot == 0) $awal = ($halaman-$tot);
else $awal = ($halaman - ($halaman % $tot));
$akhir = $awal + $tot - 1;
if($halaman>$tot){
$page_string = "<input type='button' value='...' onclick=\"showGallery($awal-$tot+1)\"> ";
}else{
$page_string = "";
}
for($i=($awal);$i<=($akhir);$i++){
$btn=$i+1;
if($i>($jumlah_page-1)) break;
if($halaman==$btn){
$disabled="disabled";
}else{
$disabled="";
}
if($btn==$jumlah_page) continue;
$page_string.="<input type='button' value='$btn' onclick=\"showGallery($btn)\" $disabled> ";
}
if(($jumlah_page-$awal)>$tot){
$page_string.="<input type='button' value='...' onclick=\"showGallery($awal+$tot+1)\"> ";
}
if($halaman==$jumlah_page) $last="disabled";
else $last="";
$page_string.="<input type='button' value='$jumlah_page' onclick=\"showGallery($jumlah_page)\" $last> ";
echo"$page_string";
?>
</div>
<?php
}
}
?>
What I have tried:
I tried to follow this code error Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in (directory) on line 20 and line 24 [duplicate]
angka){
rupiah=number_format(
angka,0,',','.'); return
这篇关于警告:mysqli_num_rows()要求参数1为mysqli_result,第20行和第24行(目录)中给出的布尔值为[duplicate]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!