Home >Backend Development >PHP Problem >How to call database in php
How PHP calls the database: first connect to the database through the "mysqli_connect" method; then execute the command "show databaces"; and finally send the command to the MySQL server.
Recommended: "PHP Video Tutorial"
1. Three ways to call the database Method:
Command (cmd), language call (PHP, GO), third-party software.
Command mode:
Language call:
<?php //链接数据库 $link = mysqli_connect('localhost', 'root', ''); //SQL命令的准备 $sql = 'show databaces'; //讲话命令发送到MySQL服务器 $res = mysqli_query($link, $sql); var_dump($res); ?>
Third-party software:
2. Operation process
Parsing completed Finally, return the result to the calling program
The above is the detailed content of How to call database in php. For more information, please follow other related articles on the PHP Chinese website!