Home >Backend Development >PHP Problem >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='center'>"; echo "<td>{$userstate[$user['state']]}</td>"; echo "<td>{$user['username']}</td>"; echo "<td>".date("Y-m-d",$user['addtime'])."</td>"; echo "<td> <a href='edit.php?id={$user['id']}'>修改</a> <a href='action.php?a=del&id={$user['id']}'>删除</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!