警告:在PDO语句上为foreach()提供的参数无效

时间:2013-11-25 13:56:30

标签: mysql pdo

我的pdo功能是:

public function viewBookReceiveByDate($startDate,$endDate){     
    $query = "SELECT * FROM `book_receive_store` WHERE `ActualDate` BETWEEN  :startDate AND :endDate";

    $statement = $this -> dbo -> prepare($query);
    $statement->bindParam(':startDate',$startDate);
    $statement->bindParam(':endDate',$endDate);
    $statement -> execute();
    $statement -> setFetchMode(PDO::FETCH_CLASS, 'BookReceive');

    $resultSet = array();
    while ($row = $statement -> fetch()) {
        $resultSet[] = $row;
    }
    return $resultSet;
}

我的数据库就像:

ID
EntryDate
ActualDate
ReferenceNo
BindingCode
BookCode
ProductQuantity
ProductType

其中ActualDate =“2013.11.01”,“2013.11.05”等

现在,当我尝试从控制器文件中的日期范围中选择数据时:

$bookReceiveManager = new BookReceiveManager();
            $getBookList = $bookReceiveManager->viewBookReceiveByDate($startDate, $endDate);
            //print_r($getBookList);
            foreach($getBookList as $recBookookList): endforeach;

它显示错误:

  

“警告:在第27行的D:\ EasyPHP-12.1 \ www \ kbl_mis \ reports \ product_receive_report_ajax.php中为foreach()提供的参数无效”

现在该怎么办?

0 个答案:

没有答案