MYSQLI_NUM是什么意思和做什么? [英] What does MYSQLI_NUM mean and do?
问题描述
我只想了解MYSQLI_NUM的一些信息.它是PHP还是MySQL的一部分.
I just wanted a little bit of information on MYSQLI_NUM. And is it part of PHP or MySQL.
推荐答案
MYSQLI_NUM是PHP中与mysqli_result相关联的常量.如果使用mysqli从数据库中检索信息,则可以使用MYSQLI_NUM指定数据的返回格式.具体来说,当使用fetch_array函数时,MYSQLI_NUM指定返回数组应对该数组使用数字键,而不是创建关联数组.假设您的数据库表中有两个字段"first_field_name"和"second_field_name",内容分别为"first_field_content"和"second_field_content" ...
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"
);
或者...
$result->fetch_array(MYSQLI_ASSOC);
获取这样的数组:
array(
"first_field_name" => "first_field_content",
"second_field_name" => "second_field_content"
);
使用常量MYSQLI_BOTH将同时获取两者.
Using the constant MYSQLI_BOTH will fetch both.
这篇关于MYSQLI_NUM是什么意思和做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!