我正在使用准备语句
<?php
if ($no_of_result > 0) { // have record that matches with query
mysqli_stmt_bind_result($stmt, $post_category,
$post_title,
$post_author,
$post_date,
$post_image,
$post_content,
$post_tags,
$post_comment_counts,
$post_status,
$post_views_counts,
$post_likes);
while ($row = mysqli_fetch_array($result)) { // have posts
get_body($row);
}
} else { // no posts and last page
echo "<h3 class='title is-3 has-text-centered'> No Result Found <h3/>" ;
}
mysqli_free_result($result);
?>
我要转换所有这些变量
$post_category,
$post_title,
$post_author,
$post_date,
$post_image,
$post_content,
$post_tags,
$post_comment_counts,
$post_status,
$post_views_counts,
$post_likes
以用作$row
的方式。函数get_body()
仅需要一个参数,所以也许我可以做类似$row['post_category']
或$row[1]
的事情,并且只需将一个参数传递给函数get_body()
即可访问所有变量? / p>
php的新手,所以我什至不知道它是否可行