This is a nested array I got from my db,
Array
(
[0] => Array
(
[Field] => blc_id
[Type] => int(10) unsigned
[Null] => NO
[Key] => PRI
[Default] =>
[Extra] => auto_increment
)
[1] => Array
(
[Field] => blc_email
[Type] => varchar(255)
[Null] => YES
[Key] =>
[Default] =>
[Extra] =>
)
[2] => Array
(
[Field] => cat_id
[Type] => varchar(255)
[Null] => YES
[Key] =>
[Default] =>
[Extra] =>
)
[3] => Array
(
[Field] => blc_created
[Type] => timestamp
[Null] => NO
[Key] =>
[Default] => 0000-00-00 00:00:00
[Extra] =>
)
[4] => Array
(
[Field] => blc_updated
[Type] => timestamp
[Null] => NO
[Key] =>
[Default] => CURRENT_TIMESTAMP
[Extra] => on update CURRENT_TIMESTAMP
)
)
How can I use foreach loop to get the result below,
Array
(
[0] => blc_id
[1] => blc_email
[2] => cat_id
[3] => blc_created
[4] => blc_updated
)
Here is my code so far but of course it doesnt return the result correctly,
foreach($items as $outer_key => $array)
{
foreach($array as $inner_key => $value)
{
$field_name[] = $value;
}
}
Thanks.
SHOW COLUMNS FROM root_blocks
. thanks. – lauthiamkok Mar 25 '11 at 15:16