This function extracts a row from the result set as Enumeration data, and obtains a row of data from the result set associated with the specified result ID and returns the data as an array. Each result column is stored in an array unit.
Mysql_fetch_rowThis function retrieves a row from the result set as Enumeration data, and obtains a row of data from the result set associated with the specified result ID and returns the row as an array. Each result column is stored in an array unit, and the offset starts from 0. Note: Here the offset starts from 0. that is to say, the field name cannot be used for the value, but the index can only be used for the value. Therefore, the following code cannot obtain the value:
While ($ row = mysql_fetch_row ($ result )){
Echo $ row ['id']. ':'. $ row [1]. ";
} // $ Row ['id'] here cannot be taken.
Mysql_fetch_arrayTo obtain a row from the result set as an associated array, or number array, or both. in addition to storing data in the array as a digital index, you can also store the data as an associated index, use the field name as the key name. That is to say, the result obtained by him is like an array and can be determined by key or index.
While ($ row = mysql_fetch_array ($ result )){
Echo $ row ['id']. ':'. $ row [1]. ";
} // Here, $ row ['CID'] and $ row [1] can get corresponding values.
Mysql_fetch_object,As the name suggests, get a row from the result set as an object and use the field name as an attribute. So only in this way can we get the value
While ($ row = mysql_fetch_object ($ result )){
Echo $ row-> id. ':'. $ row-> title ."";
}
Mysql_fetch_assocTo obtain a row from the result set as an associated array. that is to say, this function cannot use indexes to take values like mysql_fetch_row. Therefore, it can only use field names.
While ($ row = mysql_fetch_assoc ($ result )){
Echo $ row ['id']. ':'. $ row [1]. ";
} // $ Row [1] cannot be obtained.