我发现做mysqli没有准备好准备声明是一件痛苦的事情,因为许多功能都不像是一样。这是关于获取数组的问题之一。
这是我所做的改变,但没有运气 http://www.diffnow.com/?report=59xef
答案 0 :(得分:6)
您正试图通过
获取结果$result = $stmt->execute();
情况并非如此。因为execute只返回一个布尔值。
这样做。
$stmt = $db->prepare("SELECT category_id FROM post_items Where user_id = ?");
$stmt->bind_param('i', $userid);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
//result is in row
}
答案 1 :(得分:0)
.menu-left{
--width: 200px;
}
.menu-content {
height: 100% !important;
width: 200px;
}
不返回结果。你需要$stmt->execute();
。
你可以像这样重写你的代码:
$stmt->get_result();
答案 2 :(得分:-1)
替换这个:
$result = $stmt->execute();
while ($row = $result->fetch_array()) {
由此
$stmt->bind_result($category_id);
while($stmt->fetch()){
$myArray=$category_id;
}