Array
(
[0] => Array
(
[0] => 1
[id] => 1
[1] => 1
[candi_id] => 1
[2] =>
[title] =>
[3] => Lakshmanan
[firstname] => Lakshmanan
[4] => P
[lastname] => P
[5] => Male
[gender] => Male
[6] => Tamil
[mothertongue] => Tamil
[7] => 31-01-1990
[dob] => 31-01-1990
[8] => Hindu
[religion] => Hindu
[9] => O+
[bloodgroup] => O+
[10] => Single
[marital_status] => Single
[11] => Mettupalayam
[native] => Mettupalayam
[12] => Indian
[nationality] => Indian
[13] => Active
[status] => Active
[14] => 2016-11-04
[cdate] => 2016-11-04
)
)
我想只得到列值。但为什么我得到带有值的数组索引?
答案 0 :(得分:0)
首先,我想说mysql
函数已被弃用。因此,现在继续使用mysqli
或PDO
更适合mysql
databse
功能。
如果没有任何参数,mysql_fetch_array
函数会以DB
和index
两种格式输出column-name
条记录。
要将数据设为column-name
,您只需要在MYSQL_ASSOC
函数中传递第二个参数“mysql_fetch_array
”,或者也可以使用mysql_fetch_assoc
函数。
$result = mysql_fetch_assoc($mysql_query);