Server IP : 184.154.167.98 / Your IP : 3.145.51.153 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/oficios/sistema/perfil/ |
Upload File : |
<?php header('Content-type: application/json; charset=utf-8'); require_once 'dbconnect/database.class.php'; $objDB = new DataBase; $id = $_POST['id']; $employee_data = [ 'names' => $_POST['nombres'], 'address' => $_POST['direccion'], 'date_register' => $_POST['fecha_registro'], 'phone' => $_POST['telefono'], 'comment' => $_POST['comentario'], 'salary' => $_POST['salario'] ]; if($id==0){ // Nuevo $r = $objDB->Insert('crud_employees', $employee_data); if($r['result']){ $arr = ['resultado' => true, 'mensaje' => 'Empleado aƱadido', 'id' => $r['insert_id'] ]; }else{ $arr = ['resultado' => false, 'mensaje' => $r['error']]; } }else{ // Update $r = $objDB->Update('crud_employees', $employee_data, ["id" => $id]); if($r['result']){ $arr = ['resultado' => true, 'mensaje' => 'Empleado actualizado' ]; }else{ $arr = ['resultado' => false, 'mensaje' => $r['error']]; } } die(json_encode($arr));