wip: 2023-07-14T11:38:01+0200 (1689327481)

This commit is contained in:
Victor Westerlund 2023-07-27 13:49:56 +02:00
parent 740d61a89b
commit 93c82412d0

View file

@ -13,6 +13,11 @@
parent::__construct($host, $user, $pass, $db);
}
// Place value in array
private static function to_array(mixed $value): array {
return is_array($value) ? $value : [$value];
}
// Bind SQL statements
private function bind_params(\mysqli_stmt &$stmt, mixed $params) {
// Make single-value, non-array, param an array with length of 1
@ -117,4 +122,16 @@
return $query->num_rows > 0 ? true : false;
}
public function select(string $table, array|string $columns = null, string $where = "") {
// SELECT all columns if $columns is empty (wildcard "*")
$columns = self::to_array($columns ? $columns : "*");
if ($where) {
$clause = preg_match_all("/[<>!=]=|<=|>=|<>|>|<|=|LIKE|IN|IS|REGEXP/", $where);
$test = true;
}
$sql = "SELECT . FROM ${table}" . $where;
}
}