It is not recommended to use mysql_connect, mysql_query and other functions in PHP5.3 and above versions. Instead, use the mysqli series (improved). This is an example of connecting to a database and querying data.
<?php require 'conn.php'; //$link=mysqli_connect($host,$user,$pass,$database); $query="select * from user_info"; if($result=mysqli_query($link,$query)){ echo "query was successfully executed.".'<br>'; while($row=mysqli_fetch_assoc($result)){ echo $row["name"]." ".$row["surname"].'<br>'; } mysqli_free_result($result); } else{ echo "the query is not executed.".'<br>'; } mysqli_close($link); ?>
The above introduces PHP 5619 to connect to the database, including the content of connecting to the database. I hope it will be helpful to friends who are interested in PHP tutorials.