Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    MySQL PHP Syntax

    MySQL works very well with various programming languages ​​such as C, C ++, PHP, and JAVA; 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 handle 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:

    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 following tutorial will guide you on how to use other PHP MySQL functions.



    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.