Home >Backend Development >PHP Problem >What is the php database interface?

What is the php database interface?

(*-*)浩
(*-*)浩Original
2019-09-29 09:17:203819browse

What is the php database interface?

What databases does php support (which database interfaces does it have) (recommended learning: PHP video tutorial)

Adabas D ,InterBase ,PostgreSQL ,dBase ,FrontBase ,SQLite ,Empress ,mSQL ,Solid ,FilePro(只读),Direct MS-SQL ,Sybase ,Hyperwave ,MySQL ,Velocis ,IBM DB2 ,ODBC ,Unix dbm ,informix ,Oracle(OCI7 和 OCI8),Ingres ,Ovrimos

and above Databases are supported. In short, most mainstream databases are supported.

php native operation method of mysql database

<?php
//数据库操作
//1.导入数据库
require("../../public/dbconfig.php");
//2.连接数据库
$link=mysql_connect(HOST,USER,PASS) or die("数据库连接失败");
//3.选择数据库,设置字符集
mysql_select_db(DBNAME,$link);
mysql_set_charset("utf8");
//4.编写sql语句,发送sql语句到数据库
$sql="select * from users";
$res=mysql_query($sql,$link);
//5.解析结果集
while($user=mysql_fetch_assoc($res)){
echo "<tr align=&#39;center&#39;>";
echo "<td>{$userstate[$user[&#39;state&#39;]]}</td>";
echo "<td>{$user[&#39;username&#39;]}</td>";
echo "<td>".date("Y-m-d",$user[&#39;addtime&#39;])."</td>";
echo "<td>
<a href=&#39;edit.php?id={$user[&#39;id&#39;]}&#39;>修改</a> 
<a href=&#39;action.php?a=del&id={$user[&#39;id&#39;]}&#39;>删除</a>
</td>";
echo "</tr>";
}
mysql_free_result($res);
mysql_close($link);
?>

The above is the detailed content of What is the php database interface?. For more information, please follow other related articles on the PHP Chinese website!

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