VOOZH about

URL: https://www.geeksforgeeks.org/php/php-mysql-update-query/

⇱ PHP | MySQL UPDATE Query - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | MySQL UPDATE Query

Last Updated : 1 Aug, 2021
The MySQL UPDATE query is used to update existing records in a table in a MySQL database.
  • It can be used to update one or more field at the same time.
  • It can be used to specify any condition using the WHERE clause.
  • Syntax : The basic syntax of the Update Query is - 👁 Image

    Implementation of Where Update Query :

    Let us consider the following table "Data" with four columns 'ID', 'FirstName', 'LastName' and 'Age'. 👁 Image

    To update the "Age" of a person whose "ID" is 201 in the "Data" table, we can use the following code :
    Update Query using Procedural Method : Output : Table After Updation - 👁 Image

    The output on Web Browser : 👁 Image

    Update Query using Object Oriented Method : Output : Table After Updation - 👁 Image

    The output on Web Browser : 👁 Image

    Update Query using PDO Method : Output : Table After Updation - 👁 Image

    The output on Web Browser : 👁 Image

    PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.

    Comment
    Article Tags:
    Article Tags: