//对不起英语不好。
我正在编写一个博客脚本,但它并没有像我预期的那样“好”。我收到错误:
Notice: Undefined property: mysqli_result::$fetch_array
现在我知道这意味着我的 MySQLI 查询正在向我返回 NULL 或 false,但我将查询运行到 PHPMyAdmin 以查看它是否错误,但它在那里工作。
我已经尝试使用 var_dump 等进行调试,但我现在卡了一个小时,希望你们能帮助我。我的代码:
<?php
include_once "header.php";
$queryInfo = "SELECT id,datum,auteur,comments,tags,titel,omschrijving,image FROM blog ORDER BY datum DESC";
$selectqInfo = $mysqli->query($queryInfo);
?>
<div class="row">
<div class="sixteen columns">
<div class="breadcrumb">
<a href="home" class="first_bc"><span>Home</span></a>
<a href="blog" class="last_bc"><span>Blog</span></a>
</div>
<div class="page_heading"><h1>Blog</h1></div>
</div>
</div>
<div class="row">
<!-- Wide Column -->
<div class="twelve columns">
<?php
$stringBlog = array();
while($stringBlog = $selectqInfo->fetch_array);
{
?>
<div class="post_item">
<div class="pic">
<a href="blog_item.html"><img src="<?php $stringBlog['image']; ?>"/><div class="img_overlay"></div></a>
</div>
<h3 class="post_title"><a href="blog_item.html"><?php $stringBlog['titel']; ?></a></h3>
<p class="post_meta">
<span class="calendar"><a href="blog.html"><?php $stringBlog['datum']; ?></a></span>
<span class="author"><a href="blog.html"><?php $stringBlog['auteur']; ?></a></span>
<span class="comments"><a href="blog_item.html"><?php $stringBlog['comments']; ?> reacties</a></span>
<span class="tags"><a href=""><?php $stringBlog['tags']; ?></a></span>
</p>
<p class="post_description"><?php $stringBlog['omschrijving']; ?></p>
</div>
<?php
}
?>
<div class="post_item">
<div class="pic">
<a href="blog_item.html"><img src="images/blog_img2_700.jpg"/><div class="img_overlay"></div></a>
</div>
<h3 class="post_title"><a href="blog_item.html">Clean and Modern</a></h3>
<p class="post_meta">
<span class="calendar"><a href="">24 September, 2012</a></span>
<span class="author"><a href="">by Admin</a></span>
<span class="comments"><a href="">3 Comments</a></span>
<span class="tags"><a href="">Web Design</a>, <a href="">Web Development</a></span>
</p>
<p class="post_description"><?php var_dump($queryInfo, $selectqInfo, $stringBlog); ?>.</p>
</div>
//文本是荷兰语,var_dump的de值为:
string(91) "SELECT id,datum,auteur,comments,tags,titel,omschrijving,image FROM blog ORDER BY datum DESC" object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(8) ["lengths"]=> NULL ["num_rows"]=> int(2) ["type"]=> int(0) } NULL