prepareQuery(); try { $stmt = $pdo->prepare("SELECT * FROM publish_de WHERE id>0 AND p_isonline=1 ORDER BY p_timestamp DESC LIMIT 10;"); $stmt->execute(); $myRowCount = $stmt->rowCount(); $stmt = null; // doing this is mandatory for connection to get closed $pdo = null; if ( strlen($myRowCount) >= 1 || !empty($myRowCount) || is_numeric($myRowCount) ){ echo "online"; } } catch (PDOException $e) { echo "offline"; } exit(0); ?>