嘿,这就是我必须做出的,如果数据库找不到与数据库匹配的任何内容或可以找到任何内容,那么它应该站出来说点什么,但我完全决心如何构建它。我会听到可以帮助我
我尝试这样做:
<?php
if ($stmt = $mysqli->prepare('SELECT id_forum, title, tekst, dato, id_brugere FROM `forum` ORDER BY `forum`.`id` DESC'))
{
$stmt->execute();
$stmt->bind_result($id, $djnavn, $profilbillede);
$rows = $stmt->num_rows;
echo $rows;
while ($stmt->fetch())
{
?>
<td class="titleforum"></td>
<td>Dato:</td>
<?php
}
$stmt->close();
}
else
$row_cnt = $result->num_rows;
print_r($row_cnt);
?>
但它看起来没有任何说话或看起来像..我想要的是它说了些什么?
尝试:
<?php
if ($stmt = $mysqli -> prepare('SELECT id_forum, title, tekst, dato, id_brugere FROM `forum` ORDER BY `forum`.`id` DESC'))
{
$stmt -> execute();
$stmt -> store_result();
$rows = $stmt -> num_rows;
echo $rows;
while ($stmt -> fetch()) {
?>
<td class="titleforum"></td>
<td>Dato:</td>
<?php
}
$stmt->close();
}
?>
请参阅:http://php.net/manual/en/mysqli-stmt.num-rows.php