public function create($objArr) { $cols = []; $vals = []; foreach ($objArr as $col => $val) { $cols[] = $col; if (is_string($val)) { $vals[] = "'" . $val . "'"; } else { $vals[] = $val; } } $cols = implode(',', $cols); $vals = implode(',', $vals); if (!MySql::run("INSERT INTO {$this->table} ({$cols}) VALUES ({$vals})")) { return MySql::getError(); } return false; }