PDO& Foreach(非法字符串偏移)

时间:2015-10-09 22:12:51

标签: php mysql foreach

在我的应用程序中,我试图返回每个MySQL Row。除此之外,当我尝试这样做时,我收到错误:

  

[Fri Oct 09 17:03:56.314003 2015] [:error] [pid 10641] [client 127.0.0.1:40897] PHP警告:/var/www/html/ViewTicket.php中的非法字符串偏移'Date'在第79行,引用者:http://localhost/Support

     

[Fri Oct 09 17:03:56.314041 2015] [:error] [pid 10641] [client 127.0.0.1:40897] PHP警告:/var/www/html/ViewTicket.php中的非法字符串偏移'内容'在第84行,引用者:http://localhost/Support

这是我的编码:

findFragmentByTag

要继续上面的错误,它不输出任何错误只返回'1'。

1 个答案:

答案 0 :(得分:0)

我已经修好了,谢谢你。我改变了票证查询和foreach。

`

    $Reply = $db->fetchRows('SELECT * FROM ticket_replies WHERE TID = :tid', [':tid' => $ID]);
    foreach ($Reply as $TR) {
                                        $Replier = $db->fetchRow(
                                            'SELECT * FROM users WHERE UID = :poster',
                                            [':poster' => $TR['Poster']]
                                        );

`