|
Posted by NC on 02/27/06 09:22
Ninja_Monkey wrote:
>
> Could you explain how this works for me though?
>
> while ($record = mysqli_fetch_array($result, MYSQLI_NUM)) {
> echo $record[0], "<br>\r\n";
> }
When you pass a SELECT query to mysqli_query() function, it returns a
pointer to a result set, conceptually similar to a file pointer
returned by fopen(). In both cases, you need to use the pointer to
read the data it points to, record by record (or, in case of a file,
line by line). Each time you call mysqli_fetch_array(), it reads
another record from the result set until it reaches the end of the
result set. A record is returned as an array, whose structure
replicates that requested by query. In your case, the query was SHOW
DATABASES, and each record in a result set has only one field, which by
definition gets number 0...
Cheers,
NC
[Back to original message]
|