MySQL PHP Syntax

MySQL works very well with the various programming languages like PERL, C, C++, PHP, and JAVA. Out of these languages, PHP and MySQL are perfect 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.

Example:
<?php
$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.


Courses
Subscribe Updates via Email

Join 49,000+ W3schools lovers and get all the latest tutorials, programs, algorithms in your inbox.