Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在drupal 7中调用未定义的方法stdClass::count()_Drupal_Drupal 7 - Fatal编程技术网

在drupal 7中调用未定义的方法stdClass::count()

在drupal 7中调用未定义的方法stdClass::count(),drupal,drupal-7,Drupal,Drupal 7,我对Drupal7中的计数函数有一个问题 代码是: $sql = "select count(Status) from TB_Aanmeldingen where (Status= 'Ja' or Status='Ja, met kleine') and ID_Wedstrijd = :match"; $args = array(':match' => $match); $row = db_query($sql, $args)->fetchObject();

我对Drupal7中的计数函数有一个问题

代码是:

    $sql = "select count(Status) from TB_Aanmeldingen where (Status= 'Ja' or Status='Ja, met kleine') and ID_Wedstrijd = :match";
    $args = array(':match' => $match);
    $row = db_query($sql, $args)->fetchObject();
    $aantal = $row->count(Status);
错误消息:

    Call to undefined method stdClass::count()

非常感谢您的帮助

我不确定你想用它做什么:

 $aantal = $row->count(Status);
对$row对象执行print\r或var\u转储,您将看到结构是什么。db_查询返回一个DatabaseStatementInterface,您将从中获取一个对象。但是对象没有您试图调用的函数

相反,调试、打印和调试$row的值,并获取您要查找的值

另外,查看db_select。最好使用该查询,然后使用db_查询