显示数据的多维数组

时间:2016-01-21 11:04:45

标签: php multidimensional-array

categories Object
(
    [_db:categories:private] => db Object
        (
            [_pdo] => PDO Object
                (
                )

            [_query] => PDOStatement Object
                (
                    [queryString] => SELECT * FROM categories WHERE  name_of_category = ?
                )

            [_error] => 
            [_results] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 10
                            [name_of_category] => Vedran
                            [description_of_category] => adsdasdas
                            [meta_keywords] => sadasdas
                            [meta_description] => asdasdas
                            [notes] => sadsadas
                            [created] => 2016-01-20 08:26:02
                        )

                    [1] => stdClass Object
                        (
                            [id] => 9
                            [name_of_category] => VEdran
                            [description_of_category] => ddddd
                            [meta_keywords] => qsqddd
                            [meta_description] => sqdddd
                            [notes] => sddd
                            [created] => 2020-01-16 00:00:00
                        )

                )

            [_count] => 2
        )

    [_fields:categories:private] => 
)

您好。有人可以用这个数组来帮助我。我在数据库类别表中创建了。我想在页面上显示用户可以管理类别(删除,编辑)的类别。当我想从数据库中显示类别时,我在PHP中获取此数组。现在我不知道如何在网页上仅显示“name_of_category”。有人可以帮帮我吗。

1 个答案:

答案 0 :(得分:1)

    $categories=$ObjVariable->_results;

然后使用$ categories数组显示值