MySQL works very well with various programming languages ​​such as C, C ++, PHP and JAVA, and out of these languages, PHP, and MySQL are considered the perfect combination for developing web applications.

PHP provides various functions to access the MySQL database and to handling data records inside the MySQL database. You can call PHP MySQL functions, like any other PHP function.

Here in the example below, a connection is established between PHP and MySQL:


$con = mysqli_connect("localhost", "users_name", "user_pass", "db_name");

/* Select queries return a resultset */
  if ($result = mysqli_query($con, "SELECT Name FROM users")) {
  printf("Select returned %d rows.\n", mysqli_num_rows($result));

The next chapter, we will see other PHP MySQL functions.