PHP Update Db

We will now use our users table inside the database examples:

users table

 

 

 

 

Our users table has 3 columns: id, name, surname.

To UPDATE some data in our table we will:

  1. connect to the server (localhost)
  2. select a database (examples)
  3. create a SQL UPDATE query
  4. run the query and store the result
  5. check if the query has been successful

PLEASE NOTE: the UPDATE command is quite powerful, if you do not specify which row you want to update, ALL the rows will be updated. That’s why you should always use a WHERE clause.