protected function find_many($column, $value) { $columnType = Model::get_param_type($value); $query = 'SELECT * FROM ' . $this->tableName . ' WHERE ' . $column . ' = ?'; $stmt = $this->db->prepare($query); $stmt->bind_param($columnType, $value); $stmt->execute(); $result = $stmt->get_result(); $rows = []; while ($data = $result->fetch_assoc()) { $rows[] = new Model($this->db, $this->tableName, $data); } return $rows; }
public function delete() { $id = $this->data['id']; $columnType = Model::get_param_type($id); $query = 'DELETE FROM ' . $this->tableName . ' WHERE id = ?'; $stmt = $this->db->prepare($query); $stmt->bind_param($columnType, $id); return $stmt->execute(); }