Home  >  Article  >  Backend Development  >  A small example of using MySQLi extension in PHP5

A small example of using MySQLi extension in PHP5

WBOY
WBOYOriginal
2016-07-25 08:56:23809browse
  1. /**

  2. * mysqli extension example
  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. ?>

复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn