2015-03-02 61 views
-1

我有我的代码的问题,我不明白的地方是, 所以我的代码是:Mysql_num_rows,并不在我上班的功能

public function getCurrentCycle() 
{ 
    $cycle = NULL;  
    $sql="SELECT * FROM " . Test::TABLE_NAME . " WHERE NOW() BETWEEN begin_date AND finish_date LIMIT 1";    
    $res = PzfMysql :: query($sql, $this->dbconnection);  
    if(mysql_num_rows($res) == 1) 
    { 
     $cycle = PzfMysql::fetch_object($res, 'Test'); 
    } 
    return $cycle; 
} 

我验证了这 - $> DBConnection的设置=连接的名称,$水库是retourn资源ID#11,但我得到一个错误:

ERROR : 2, mysql_num_rows() expects parameter 1 to be resource, null 

请帮助我,THX提前

+0

'$ res = PzfMysql :: query($ sql,$ this-> dbconnection);'在这里没有正确地产生结果。 – 2015-03-02 09:53:36

+0

我做了一个回声,它返回资源ID#11 – TanGio 2015-03-02 09:55:16

+1

Mysql已弃用。停止使用它。 – Gogol 2015-03-02 10:32:05

回答