public $engine;
public $created;
public static $is_admin = true;
- public $key_preff = '_key_';
+# NB 28.07.18 public $key_preff = '_key_';
+ public $key_preff = '';
public $fields = [];
public $fields_only = []; # filter for rows
if ($field->extras) continue;
- $value = $post[$this->ppreff().$name];
+# NB 28.07.18 $value = $post[$this->ppreff().$name];
if ($field->key) {
$keys[] = $name;
continue;
}
-# NB 12.12.17 $_value = isset($post[$this->key_preff.$name]) ? $post[$this->key_preff.$name] : null;
-
- if (isset($post[$this->key_preff.$name])) {
+# NB 28.07.18 if (isset($post[$this->key_preff.$name])) {
$fields[] = $name;
$fields_values[] = $post[$this->key_preff.$name];
$keys_values[] = $post[$this->key_preff.$name];
- } else {
- $keys_values[] = $value;
- }
+# NB 28.07.18 } else {
+# NB 28.07.18 $keys_values[] = $value;
+# NB 28.07.18 }
- } else {
+# NB 28.07.18 } else {
+ } elseif(isset($post[$this->key_preff.$name])) {
$fields[] = $name;
- $fields_values[] = $value;
+# NB 28.07.18 $fields_values[] = $value;
+ $fields_values[] = $post[$this->key_preff.$name];
}
.' WHERE ' . join(' AND ',$this->ar_map('"$a=:key_$a"',$keys))
;
#$info['sql'] = $sql;
+ #bye($sql);
$info = [ 'sql' => $sql ] + $info;
if ($bindParam and !($query = $this->db()->conn->prepare($sql))) {
currency_name varchar(20),
phone varchar(30),
zip_format varchar(60),
- zip_regexp varchar(150),
+ zip_regexp varchar(300),
languages varchar(100),
geoid bigint,
neighbours varchar(60),
} elseif ($action == 'insert') {
$this->deniedUnless($this->perm >= self::WRITE);
- if (!$this->table->insert($_POST,$info)) $this->error('insert: '.print_r($info,true));
+ if (!$this->table->insert(empty($_POST) ? $_GET : $_POST,$info)) $this->error('insert: '.print_r($info,true));
header('Location: '.$this->table->base.'/');
$this->page($info);
} elseif ($action == 'update') {
$this->deniedUnless($this->perm >= self::WRITE);
- if (!$this->table->update($_POST,$info)) $this->error('update: '.print_r($info,true));
+ if (!$this->table->update(empty($_POST) ? $_GET : $_POST,$info)) $this->error('update: '.print_r($info,true));
$this->redirect_if_no_referer($this->table->base.'/');
$this->page($info);
} elseif ($action == 'replace') {
$this->deniedUnless($this->perm >= self::WRITE);
- if (!$this->table->replace($_POST,$info)) $this->error('replace: '.print_r($info,true));
+ if (!$this->table->replace(empty($_POST) ? $_GET : $_POST,$info)) $this->error('replace: '.print_r($info,true));
$this->redirect_if_no_referer($this->table->base.'/');
$this->page($info);