警告:mysqli_fetch_array()要求参数1为mysqli_result,在/home/solut644/public_HTML/wp-content/plugins/insert-PHP/includes/shortcodes.php(66)中给出布尔值:第13行的eval()代码 [英] Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/solut644/public_HTML/wp-content/plugins/insert-PHP/includes/shortcodes.php(66) : eval()'d code on line 13
本文介绍了警告:mysqli_fetch_array()要求参数1为mysqli_result,在/home/solut644/public_HTML/wp-content/plugins/insert-PHP/includes/shortcodes.php(66)中给出布尔值:第13行的eval()代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过php snippets插件将这些代码添加到WordPress帖子中但是,我在第13行和第41行中遇到了这个错误。
我尝试过的事情:
I'm trying to add these code down below to the WordPress post through php snippets plugin but, i stuck in this error in line number 13 and 41.
What I have tried:
echo '<a class="bg-danger btn btn-default" href="index.php" ';
global $post, $wpdb;
if( !isset($_GET['char']) ){
echo ' class="active" ';
}
echo ' >All</a></li>';
// Select Alphabets and total records
$alpha_sql = "select DISTINCT LEFT(title , 1) as firstCharacter,
( select count(*) from products where LEFT(title , 1)= firstCharacter ) AS counter
from products
order by title asc";
$result_alpha = mysqli_query($wpdb->dbh,$alpha_sql);
while($row_alpha = mysqli_fetch_array($result_alpha)){
$firstCharacter = $row_alpha['firstCharacter'];
$counter = $row_alpha['counter'];
echo '<a class="btn btn-default" href="?char='.$firstCharacter.'" ';
if( isset($_GET['char']) && $firstCharacter == $_GET['char'] ){
echo ' class="active" ';
}
echo ' >'.$firstCharacter.'</a></li>';
}
?>
<?php
// selecting rows
$sql = "SELECT * FROM products where 1";
if( isset($_GET['char']) ){
$sql .= " and LEFT(title,1)='".$_GET['char']."' ";
}
$sql .=" ORDER BY title ASC";
$result = mysqli_query($wpdb->dbh,$sql);
$sno = 1;
while($fetch = mysqli_fetch_array($result)){
$title = $fetch['title'];
$meaning = $fetch['meaning'];
$description = $fetch['description'];
?>
<tbody>
<tr>
<td><?php echo $sno; ?></td>
<td><?php echo $title; ?></td>
<td><?php echo $meaning; ?></td>
<td><?php echo $description; ?></td>
</tr>
</tbody>
<?php
$sno ++;
} ?>
</table>
推荐答案
post,
wpdb;
if(!isset(
wpdb; if( !isset(
_GET ['char'])){
echo'class =active';
}
echo'>全部< / a>< / li>';
//选择字母和总记录
_GET['char']) ){ echo ' class="active" '; } echo ' >All</a></li>'; // Select Alphabets and total records
这篇关于警告:mysqli_fetch_array()要求参数1为mysqli_result,在/home/solut644/public_HTML/wp-content/plugins/insert-PHP/includes/shortcodes.php(66)中给出布尔值:第13行的eval()代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文