public function deleteComment( $id, $check_author = true ) {
$q = $this -> database -> prepare( "SELECT `id`, `aid` FROM `addon_comments` WHERE `id` = :id" );
$q -> execute( array( 'id' => $id ) );
if( !$q -> rowCount( ) )
return -1;
$r = $q -> fetch( );
$uid = $this -> registry -> getClass( 'Users' ) -> isLogged( );
if( $check_author && $r[ 'aid' ] != $uid )
return -2;
$s = $this -> database -> prepare( "DELETE FROM `addon_comments` WHERE `id` = :id OR `parent` = :id" );
$s -> execute( array( 'id' => $id ) );
return 1;
}
函数返回给我-1,但查询删除了行。当我评论删除查询时,一切正常(函数返回1)。我做错了什么?