Home  >  Article  >  php教程  >  PHP5 连接mysql数据类

PHP5 连接mysql数据类

WBOY
WBOYOriginal
2016-06-13 10:38:48774browse

@ $db = new mysqli_connect(主机,用户名,密码,数据库名); //连接数据库

$sql = "";

$result = $db->query($sql);         //执行sql语句

$num_results = $result->unm_rows;   //返回行数

$row = $result->fetch_row($result); //取出一行数据 或用

$row = $result->object();   //将一行数据返回到一个对象里 例如 $row->title 
  • 来源: 编程之家
  • 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