PHP MySQL Functions to get records of a table as an arraymysql_fetch_row() function returns a record by taking a result identifier. Here it returns the set of data as an array. To get the value from the array we have to use array offset staring from 0. Each call to this mysql_fetch_row function returns the next record. Here one record is returned at a time and returns false if there is no more record to return. So we can easily use this function inside a while loop and display all the records. Each time at the starting of the while loop the mysql_fetch_row() function is checked and if true then the loop is executed and the records are displayed. Here is one example and we have used our student table for this.
Here is the result of above code
7,My John Rob,Fifth,78
If you are using PHP PDO then here is similar script.
The SQL Dump is here for you to create the table and fill the data
Subscribe to our YouTube Channel here
This article is written by plus2net.com team. https://www.plus2net.com
More on PHP MySQL functions