MySQL DatabaseLesson 65Free preview
MySQL Select Data
This lesson is part of PHP · All levels
Summary
The SELECT command is used to read data from one or more columns in a table, resulting in a set of rows stored in the result set. You read the result of the set line by line using mysqli_fetch_assoc() or mysqli_fetch_row(). The number of lines returned can be checked with mysqli_num_rows() before processing.
Key points
- SELECT columns from the data reading table; SELECT * takes all columns.
- Mysqli_query() returns the result set read with mysqli_fetch_assoc().
- Fetch_assoc() produces an array named column, fetch_row() numbered, fetch_object() object-shaped.
- Looping the result set is done with while until there are no more lines.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.