Exemplo n.º 1
0
             $delete->delete_var($key, $table);
             $delete->delete_var_prod($key, $field);
         }
         echo json_encode(true);
         return;
     }
     if (isset($_POST['save'])) {
         $update = new Update();
         foreach ($array as $key => $value) {
             if ($table == 'roominess_mav' || $table == 'roominess_mob') {
                 $int = (int) preg_replace("/[^0-9]/", '', $value);
                 $sql = "UPDATE {$table} SET {$field}='{$value}', int_val='{$int}' WHERE id='{$key}'";
             } else {
                 $sql = "UPDATE {$table} SET {$field}='{$value}' WHERE id='{$key}'";
             }
             $update->updateData($sql);
         }
         echo json_encode(true);
         return;
     }
 } elseif (is_string($_POST['arr_data'])) {
     $data = $_POST['arr_data'];
     $table = $_POST['table'];
     $field = $_POST['field'];
     if ($table == 'roominess_mav' || $table == 'roominess_mob') {
         $int = (int) preg_replace("/[^0-9]/", '', $data);
         $sql = "INSERT INTO " . $table . "(" . $field . ",int_val) VALUE ('{$data}','{$int}')";
     } else {
         $sql = "INSERT INTO " . $table . "(" . $field . ") VALUE ('{$data}')";
     }
     $insert = new Insert();
Exemplo n.º 2
0
<?php

require_once 'models/update.php';
$update = new Update();
$update->setData();
$update->updateData();
require 'views/update.php';