Php 未捕获异常';PDO异常';在使用pdo包装类时

Php 未捕获异常';PDO异常';在使用pdo包装类时,php,mysql,pdo,xampp,Php,Mysql,Pdo,Xampp,我使用的是php pdo包装类 我得到以下错误 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in C:\xampp\htdocs\mysite\include\SimplePDO.php:200 Stack trace: #0 C:\xampp\htdocs\mysite\i

我使用的是php pdo包装类

我得到以下错误

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in C:\xampp\htdocs\mysite\include\SimplePDO.php:200 Stack trace: #0 C:\xampp\htdocs\mysite\include\SimplePDO.php(200): PDO->prepare('') #1 C:\xampp\htdocs\mysite\include\SimplePDO.php(244): SimplePDO->query(false, Array, true) #2 C:\xampp\htdocs\mysite\articles.php(57): SimplePDO->get_results(false) #3 {main} thrown in C:\xampp\htdocs\mysite\include\SimplePDO.php on line 200  
包装器类代码:

 public function query( $query, $bindings = array(), $internal_call = false )
{
    $this->counter++;
    $this->c_query = $this->pdo->prepare( $query );
    if( empty( $bindings ) )
    {
        $this->c_query->execute();
    }
    else
    {
        $this->c_query->execute( (array)$bindings );
    }

    //Alternate the response based on class internal vs. direct call to "query()"
    if( $internal_call === true )
    {
        return $this->c_query;   
    }
    elseif( $this->c_query && $this->lastid() )
    {
        return $this->lastid(); 
    }
    else
    {
        return false;
    }
}
//end query()


  public function get_results( $query, $bindings = array() )
{
    return $this->query( $query, $bindings, true )->fetchAll();
}
//end get_results()
我正在尝试的问题如下:

$q1 = $database1->query( "SELECT * FROM sa_articleuploads_by_admin WHERE language=? ORDER BY article_upload_date AND article_subject ASC ", array( 'marathi' ));
$objTotalRS1 = $database1->get_results( $q1 );
$counts = 1;
$len = $database1->num_rows( $q1 );

if ($len !=0){
  foreach ($objTotalRS1 as $data){
    ......////rest of my code
我检查了,有语言栏,也检查了打字错误。但无法找到抛出错误的原因。

我正在使用php版本5.6.15在XAMPP本地服务器上尝试此功能)


感谢您的好意

在另一个类中包装PDO是一个常见错误。这不会导致一场维护噩梦,你只会在一个完美工作的软件中添加bug。你们公司雇佣的下一个PHP开发者可能知道如何使用PDO,但他需要从头开始学习这个包装器。在另一个类中包装PDO是一个常见的错误。这不会导致一场维护噩梦,你只会在一个完美工作的软件中添加bug。你们公司雇佣的下一个PHP开发者可能知道如何使用PDO,但他需要从头开始学习这个包装器。