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 UPDATE

    The UPDATE statement is used to modify data in a table.

    Syntax:

    UPDATE table_name
    SET column=value, column1=value1,...
    WHERE someColumn=someValue

    Example:

    Earlier in the tutorial, we created a table named "Employee". Here is how it looks:

    FirstName LastName Salary
    Chris benoit 5000
    Anna Weston 8000

    The following example updates some data in the "employee" table:

    Example:

    <?php
    // Database connection establishment
        $con=mysqli_connect("example.com","alex","qwerty","db_name");
        
    // Check connection
        if (mysqli_connect_errno($con)) {
        echo "MySQL database connection failed: " . mysqli_connect_error();
        }
    
        mysqli_query($con,"UPDATE employee SET salary = `10000`
             WHERE FirstName = `Anna` AND LastName = `Weston`");
    
    ?>  

    After the update, the "employee" table will look like this:

    FirstName LastName Salary
    Chris benoit 5000
    Anna Weston 10000


    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.