">
当前位置:Gxlcms > PHP教程 > PHP5中使用MySQLi扩展的小例子

PHP5中使用MySQLi扩展的小例子

时间:2021-07-01 10:21:17 帮助过:24人阅读

  1. /**

  2. * mysqli扩展示例
  3. * by bbs.it-home.org
  4. */

  5. $mysqli = mysqli_connect("localhost", "root", "","mydatabase", 3306);

  6. $result = mysqli_query($mysqli, "SELECT * FROM mytable");

  7. while($row = mysqli_fetch_array($result)) {

  8. foreach($row as $key => $value) {

  9. echo "$key = $value
    \n";
  10. }
  11. }

  12. mysqli_free_result($result);

  13. mysqli_close($mysqli);
  14. ?>

人气教程排行