Home >Backend Development >PHP Problem >There are several pieces of data in the php statistics database
The materials that need to be prepared are: computer, php editor, and browser.
1. First, open the php editor and create a new php file, for example: index.php. (Recommended learning: PHP programming from entry to proficiency)
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);
3. The browser runs the index.php page, and the number of records in the stu table is printed out as 5.
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!