Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

dbarray

Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. dbarray() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

dbarray

Quote

dbarray ( resource $query )


Parameters
query
The result resource that is being evaluated. This result comes from a call to dbquery().

Return Values
Returns an associative array of strings that corresponds to the fetched row, or FALSE if there are no more rows.

If two or more columns of the result have the same field names, the last column will take precedence.
To access the other column(s) of the same name, you either need to access the result with numeric indices by using mysql_fetch_row() or add alias names.

Example
Code
<?php
 
$result = dbquery(
 "SELECT id as userid, fullname, userstatus
 FROM sometable
 WHERE userstatus = 1"
);
 
if (dbrows($result)) {
 // While a row of data exists, put that row in $row as an associative array
 // Note: If you're expecting just one row, no need to use a loop
 // Note: If you put extract($data); inside the following loop, you'll
 // then create $userid, $fullname, and $userstatus
 while ($data = dbarray($result)) {
 echo $data["userid"];
 echo $data["fullname"];
 echo $data["userstatus"];
 }
} else {
 echo "No data in table.";
}
 
?>

Here we lists up all the results from "sometable" where userstaus = 1.

Notes
Field names returned by this function are case-sensitive.