调用未定义的方法DB_Error :: fetchInto

时间:2014-03-11 06:58:06

标签: php mysql

如何解决此错误?谢谢。

更新我的问题

第22行的错误是

<?php while( $res->fetchInto( $row,DB_FETCHMODE_ASSOC ) ) { ?>

我的网页代码是

<?php
  // Install the DB module using 'pear install DB'
  require_once( "db.php" );

  $data = array();

  $db =& DB::connect("mysql://root@localhost/srdp", array());
  if (PEAR::isError($db)) { die($db->getMessage()); }

  $res = $db->query( "SELECT * FROM names ORDER BY last" );
  ?>
  <html>
  <body>
  <table>
  <tr>
  <th>ID</th>
  <th>First</th>
  <th>Middle</th>
  <th>Last</th>
  <th>Email</th>
  </tr>
  <?php while( $res->fetchInto( $row,DB_FETCHMODE_ASSOC ) ) { ?>
  <tr>
  <td><?php echo( $row['No_KP'] ); ?></td>
  <td><?php echo( $row['Nama'] ); ?></td>
  <td><?php echo( $row['middle'] ); ?></td>
  <td><?php echo( $row['last'] ); ?></td>
  <td><?php echo( $row['email'] ); ?></td>
  </tr>
  <?php } ?>
  </table>
  Download as an 
  <a href="listxl.php">Excel spreadsheet</a>.
 </body>
  </html>

0 个答案:

没有答案