Microweber\Providers\DatabaseManager::get_by_id PHP Method

get_by_id() public method

It returns full db row from a db table
public get_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : array | boolean | mixed
$table string Your table
$id integer | string The id to get
$field_name string You can set custom column to get by it, default is id
return array | boolean | mixed
    public function get_by_id($table, $id = 0, $field_name = 'id')
    {
        if ($field_name == 'id' and $id == 0) {
            return false;
        }
        if ($field_name == false) {
            $field_name = 'id';
        }
        if ($field_name == 'id' or is_numeric($id)) {
            $id = intval($id);
        }
        $params = array();
        $params[$field_name] = $id;
        $params['table'] = $table;
        $params['single'] = true;
        $data = $this->get($params);
        return $data;
    }