What does MYSQLI_NUM mean and do?
I just wanted a little bit of i开发者_如何转开发nformation on MYSQLI_NUM. And is it part of PHP or MySQL.
MYSQLI_NUM is a constant in PHP associated with a mysqli_result. If you're using mysqli to retrieve information from the database, MYSQLI_NUM can be used to specify the return format of the data. Specifically, when using the fetch_array function, MYSQLI_NUM specifies that the return array should use numeric keys for the array, instead of creating an associative array. Assuming you have two fields in your database table, "first_field_name" and "second_field_name", with the content "first_field_content" and "second_field_content"...
$result->fetch_array(MYSQLI_NUM);
fetches each row of the result like this:
array(
0 => "first_field_content",
1 => "second_field_content"
);
Alternatively...
$result->fetch_array(MYSQLI_ASSOC);
fetches an array like this:
array(
"first_field_name" => "first_field_content",
"second_field_name" => "second_field_content"
);
Using the constant MYSQLI_BOTH will fetch both.
It is a PHP constant used in mysqli_fetch_array()
This tells the function that you want it to return a record from your results as a numerically indexed array instead of an associative one (MYSQLI_ASSOC) or both (MYSQLI_BOTH).
Alternatively, you can just use mysqli_fetch_row() to do the same thing.
Google is your friend! ;) MYSQLI_NUM is a PHP constant used by the mysqli database extension;
http://uk3.php.net/manual/en/mysqli.constants.php
精彩评论