MySQL DatabaseLesson 61Free preview
MySQL Insert Data
This lesson is part of PHP · All levels
Summary
The new data is entered using the INSERT INTO command that lists the columns and their values. The value of the text is written in a single quotation mark, while the numbers may be direct. For data coming from users, use prepared statement to be secure from SQL injection.
Key points
- INSERT INTO tables (columns) VALUES add one row of data.
- The number and order of values shall correspond to the list of columns mentioned.
- The text is written with a single quotation mark, a number without a quotation mark.
- Always use prepared statement for values that come from user input.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.