/** * @return array */ protected static function getColumn($sql) { $conn = Rasa_Reporter::getConnection(); try { $stmt = $conn->query($sql); } catch (Exception $e) { $msg = sprintf('Error %s: %s', $e->getCode(), $e->getMessage()); $logger->err($msg); $this->setLastError($msg); $stmt = null; return false; } if (!$stmt) { $msg = sprintf('Error %s: %s', $conn->errno, $conn->error); $logger->err($msg); $this->setLastError($msg); return false; } $rows = array(); if (is_callable(array($stmt, 'fetch_all'))) { $rows = $stmt->fetch_all(MYSQLI_ASSOC); } else { for ($rows = array(); $tmp = $stmt->fetch_array(MYSQLI_ASSOC);) { $rows[] = $tmp; } } $rv = array(); foreach ($rows as $row) { $rv[] = $row['name']; } return $rv; }