Updating a record in mysql
You may also be interested in getting the PHP e Book Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!
The process of updating or editing a record or row of a table makes use of the trusty mysql_query() function.
Once again we will be working with the data from a previous example.
Sandy has just had a birthday and she now 22 years old.
In a table where Sandy is not the only entry, this may become a problem, and a more sophisticated solution would be necessary.If you would rather download the PDF of this tutorial, check out our My SQL e Book from the store.Our job now is to update her age using My SQL commands like UPDATE, SET, and WHERE.Now it is important to note that this query would have updated ALL records that had an age of 21 to the new age of 22.
One of the columns in this table is called "Seniority" and it holds an integer value of how many months an employee has worked at your company.
Unfortunately for you, your job is to update these numbers every month.