public getDataRow ( string $query, callable $callback = null, array $params = [] ) : mixed | ||
$query | string | The query to execute. |
$callback | callable | A callback function to apply to the row |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
return | mixed | A single database result object or the result of the callback function. |
public function getDataRow($query, $callback = null, array $params = [])
{
return $this->getResults($query, $callback, true, $params);
}
/** * {@inheritDoc} */ public function read($session_id) { $id = sanitize_string($session_id); $query = "SELECT * FROM {$this->db->getTablePrefix()}users_sessions WHERE session='{$id}'"; $result = $this->db->getDataRow($query); if ($result) { return (string) $result->data; } else { return false; } }