-1

嘿,这就是我必须这样做的方式,如果数据库找不到与数据库匹配的任何内容或可以找到任何内容,那么它应该站出来说些什么,但我完全决定如何构建它。我会听到可以帮助我

我尝试这样做:

<?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);
?>

但它似乎没有任何东西在说话或看起来像..我想要的是它说了什么?

4

1 回答 1

0

尝试:

<?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

于 2012-05-28T19:07:20.807 回答