为什么PHP手册说fetch()不存在

时间:2015-12-12 06:41:38

标签: php mysql pdo

在PHP中,显然可以执行以下操作(使用mySQL PDO连接时)

 $scope.projects = [{
            "id": "1",
            "name": "Project 1",
            "time": "1pm - 2.30 pm",
            "comment": "some comment on project",
            "estimation": "1.5 hr",
            "task": "Working on project task"
        }, {
            "id": "2",
            "name": "Project 2",
            "time": "1pm - 2.30 pm",
            "comment": "some comment on project",
            "estimation": "5 hr",
            "task": "Working on project task"
        }, {
            "id": "3",
            "name": "Project 3",
            "time": "1pm - 2.30 pm",
            "comment": "some comment on project",
            "estimation": "6 hr",
            "task": "Working on prject task"

        }];

但是,PHP手册说while ($row = $result->fetch()) { } 不存在:

PHP Manual says that 'fetch()' doesn't exist

发生了什么事?我怎样才能更好地学习导航PHP手册?

1 个答案:

答案 0 :(得分:1)

fetch函数是PDOStatement类的成员函数。可以找到相同的文档here(DevDocs.io)和here(php.net)。