MySQL DatabaseLesson 69Free preview
MySQL Update Data
This lesson is part of PHP · All levels
Summary
The UPDATE command modifies the value of the column on an existing row, with the SET clause determining the change and the WHERE clause determining the target. Without WHERE, the entire table line would be subject to change so it would have to be avoided in normal operations. Like other operations, use the prepared statement for the value of the user input.
Key points
- UPDATE the table SET column = WHERE value the condition to update the old data.
- The WHERE clause must be in place to prevent the entire table from changing.
- Mysqli_affected_rows() shows how many lines have actually changed.
- The dynamic value of the user is required by the binding parameter.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.