Loading video...
SELECT QUERIES from PHP
SELECTqueries return a ‘table’ of data known as a result set.-
SELECTqueries are run usingMySQLi->query()and will return aMySQLi_Resultobject, which is a class is used to represent result sets returned fromSELECTqueries.- It has the property
num_rowswhich holds the number of rows in the result set. - It has the following methods for processing the result set, which will return
NULLif there are no more rows in the result set:fetch_assoc()– fetch a row of the result set & return it as an associative arrayfetch_object()– fetch a row of the result set & return it as an object of classstdClass
- It has the property
fetch_assoc()returns the next row of a result set as an associative array with the keys of the array being the names of the columns in the result set.- PHP has a built-in class called
stdClassthat can be used to hold data in object form as object properties. All of the properties of an instance of astdClassobject are publicly accessible. fetch_object()returns the next row of a result set as astdClassobject with property names matching the names of the columns in the result set.MySQLi_Result->free()is used to free memory used by a result set. It should always be called after the processing of a result set is finished.- Additional Resources:
SELECT QUERIES from PHP
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

































Start Learning Now
Our free lessons will get you started (Flash® 10 required).
Sign up for Educator.comGet immediate access to our entire library.
Features Overview