In front of us the two ways of getting the result set of data, so we have today to introduce mysql_fetch_row () function to obtain the results of the third set, the function and in front of that function similar usage! Wuxi marble measurement platform
Also function syntax is as follows:
1 |
|
mysql_fetch_row () function associated with the specified from the identification result acquiring a row of data in the result set and returned as an array, this array variable $ row given row, each column stores the results in an array element, from below zero, that is to $ row [0] in the form of access to the first array element (only one is true when the elements), the first call to mysql_fetch_row () function returns the next row in the result set, know no more rows it will return false.
Note: This function returns field names case sensitive!
The following examples of the two preceding articles in the function is the same, except that the following examples are set each record acquisition result by mysql_fetch_row () function is progressive. Then echo statement from the array output result set book information corresponding to each field.
The development of specific steps are as follows:
1. Create a project, add form, connect to the database, the database and selection process to achieve the same with the previous article, here is not repeated, the next is not clear a small partner can see, we have a connection to.
And 2. the previous article, except that the present example using mysql_fetch_row () function progressive obtain the results set record, the core code is as follows:
1 2 3 4 5 6 7 8 9 |
|
3. Use the conditional statement if the result set variable $ row judge, if the value is false, then the output you retrieve information does not exist, otherwise do ... while loop information by way of the output of the array of focus, the core code show as below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Operating results and the results of the previous two articles of the above examples is the same run, the chart pasted here, little friends can try it yourself at the local!