PHP7 has not mysql_connect to create the database. Instead, use mysql_connect to create the database.
Here only way to create the database:
Database connections:
$mysqli = new mysqli('localhost', 'root', '1111', 'lib');
Mysql query statement:
$res = $mysqli->query('select * from tb_student');
Reading three functions:
mysql_assoc: Fetch a row from the result as an associative array
mysql_array: Fetch row from the results as an associative array, a numeric array, or both
mysql_row: Fetch a row from the result as a numeric array
Read the results of which are:
First, you can read line by line:
print_r(mysqli_fetch_assoc($res));
Two, can be read out together, and then have to cycle:
$n = 0;
while($n < mysqli_num_rows($res)){
echo $row[$n]['stu_num'].$row[$n]['name']."\n";
// echo "string";
$n++;
}