Home >Backend Development >PHP Problem >There are several pieces of data in the php statistics database

There are several pieces of data in the php statistics database

(*-*)浩
(*-*)浩Original
2019-09-17 11:21:324667browse

The materials that need to be prepared are: computer, php editor, and browser.

There are several pieces of data in the php statistics database

1. First, open the php editor and create a new php file, for example: index.php. (Recommended learning: PHP programming from entry to proficiency)

There are several pieces of data in the php statistics database

2. In index.php, enter the code:

$conn = new mysqli('10.5.15.177', 'root', '', 'test');
$sql = "select * from stu";
$r = $conn->query($sql);
print_r($r->num_rows);

There are several pieces of data in the php statistics database

3. The browser runs the index.php page, and the number of records in the stu table is printed out as 5.

There are several pieces of data in the php statistics database

The above is the detailed content of There are several pieces of data in the php statistics database. 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

Related articles

See more