當前位置: 首頁>>代碼示例>>PHP>>正文


PHP crud::simpan方法代碼示例

本文整理匯總了PHP中crud::simpan方法的典型用法代碼示例。如果您正苦於以下問題:PHP crud::simpan方法的具體用法?PHP crud::simpan怎麽用?PHP crud::simpan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在crud的用法示例。


在下文中一共展示了crud::simpan方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: user_simpan

 public function user_simpan()
 {
     if (akses::aksesLogin() == TRUE or akses::aksesUser() == TRUE) {
         $nama = $this->input->post('nama');
         $user = $this->input->post('user');
         $pass1 = $this->input->post('pass1');
         $pass2 = $this->input->post('pass2');
         $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
         $this->form_validation->set_rules('nama', 'Nama', 'required');
         $this->form_validation->set_rules('user', 'Username', 'trim|required|min_length[4]');
         $this->form_validation->set_rules('pass1', 'Password', 'trim|required|min_length[5]|matches[pass2]');
         $this->form_validation->set_rules('pass2', 'Ulang Password', 'trim|required|min_length[5]');
         if ($this->form_validation->run() == FALSE) {
             $msg_error = array('nama' => form_error('nama'), 'user' => form_error('user'), 'pass1' => form_error('pass1'), 'pass2' => form_error('pass2'));
             $has_error = array('nama' => 'has-error', 'user' => 'has-error', 'pass1' => 'has-error', 'pass2' => 'has-error');
             $this->session->set_flashdata('form_error', $msg_error);
             $this->session->set_flashdata('has_error', $has_error);
             $this->session->set_flashdata('nama', $nama);
             $this->session->set_flashdata('user', $user);
             redirect('page=pengaturan&act=user_list');
         } else {
             $pass_secure = $this->encrypt->encode_url($pass1);
             //                if($pass1 != $pass2){
             //                    $this->session->set_flashdata('nama', $nama);
             //                    $this->session->set_flashdata('user', $user);
             //                    $this->session->set_flashdata('pengaturan','<div class="alert alert-danger">Password tidak sama !!</div>');
             //                }else{
             $cek = $this->db->query("SELECT * FROM tbl_user WHERE username='" . $user . "'")->num_rows();
             if ($cek == 1) {
                 $this->session->set_flashdata('nama', $nama);
                 $this->session->set_flashdata('user', $user);
                 $this->session->set_flashdata('pengaturan', '<div class="alert alert-danger">Username tidak bisa digunakan / sudah ada !!</div>');
                 redirect('page=pengaturan&act=user_list');
             } else {
                 $data = array('nama' => $ym, 'nama' => $nama, 'username' => $user, 'password' => $pass_secure, 'status' => 'active', 'level' => 'user');
                 $s = crud::simpan('tbl_user', $data);
                 if ($s == TRUE) {
                     $this->session->set_flashdata('produk', '<div class="alert alert-success">Username : <b>' . $user . '</b>, berhasil ditambahkan !!</div>');
                     redirect('page=pengaturan&act=user_list');
                 } else {
                     $this->session->set_flashdata('pengaturan', '<div class="alert alert-danger">Username gagal disimpan !!</div>');
                     redirect('page=pengaturan&act=user_list');
                 }
             }
             //                }
         }
     } else {
         $this->session->set_flashdata('login', '<div class="alert alert-danger">Maaf, anda session habis. Silahkan login ulang.</div>');
         redirect(site_url());
     }
 }
開發者ID:mikhaelfelian,項目名稱:PROJECT-RESTO-TIGERA,代碼行數:51,代碼來源:pengaturan.php

示例2: trans_menu_tambahan

 public function trans_menu_tambahan()
 {
     $kas = $this->cart->contents();
     $no_nota = $this->input->get('id_pesanan');
     $no_meja = $this->input->get('id_meja');
     $total = $this->input->get('total');
     foreach ($kas as $cart) {
         $nota_det = array('id_meja' => $cart['options']['id_meja'], 'id_menu' => $cart['options']['id_menu'], 'tgl' => date('Y-m-d H:i:s'), 'no_nota' => $this->encrypt->decode_url($no_nota), 'menu' => '+ ' . $cart['name'], 'harga' => $cart['price'], 'jml' => $cart['qty'], 'subtotal' => $cart['subtotal']);
         crud::simpan('tbl_orderlist_det', $nota_det);
     }
     crud::update('tbl_orderlist', 'no_nota', $this->encrypt->decode_url($no_nota), array('tgl_update' => date('Y-m-d H:i:s'), 'total' => $total));
     $this->cart->destroy();
     redirect('pesan/detail.php?id=' . $no_meja);
 }
開發者ID:mikhaelfelian,項目名稱:PROJECT-RESTO-TIGERA,代碼行數:14,代碼來源:transaksi.php

示例3: menu_simpan

 public function menu_simpan()
 {
     $kat = $this->input->post('kategori');
     $kode = $this->input->post('kode');
     $menu = $this->input->post('menu');
     $harga = $this->input->post('harga');
     $ket = $this->input->post('ket');
     $folder = realpath('../assets/gbr');
     $file = $_FILES['file']['name'];
     $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
     $this->form_validation->set_rules('kategori', 'Kategori', 'required');
     $this->form_validation->set_rules('kode', 'Kode Menu', 'required');
     $this->form_validation->set_rules('menu', 'Menu', 'required');
     $this->form_validation->set_rules('harga', 'Harga', 'required');
     $this->form_validation->set_rules('ket', 'Keterangan', 'required');
     if ($this->form_validation->run() == FALSE) {
         $msg_error = array('kategori' => form_error('penjahit'), 'kode' => form_error('kode'), 'menu' => form_error('menu'), 'harga' => form_error('harga'), 'file' => form_error('file'));
         $has_error = array('kategori' => 'has-error', 'kode' => 'has-error', 'menu' => 'has-error', 'harga' => 'has-error', 'file' => 'has-error');
         $this->session->set_flashdata('form_error', $msg_error);
         $this->session->set_flashdata('has_error', $has_error);
         redirect('page=menu&act=menu_tambah');
     } else {
         if (!empty($file)) {
             // Konfigurasi upload gambar
             $config['upload_path'] = $folder;
             $config['allowed_types'] = 'jpg|png';
             $config['max_size'] = '4096';
             $config['remove_spaces'] = TRUE;
             $config['file_name'] = 'menu_' . strtolower($menu);
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload('file')) {
                 $this->session->set_flashdata('menu', '<div class="alert alert-danger">Error : <b>' . $this->upload->display_errors() . '</b></div>');
                 redirect('page=menu&act=menu_tambah');
             } else {
                 $f = $this->upload->data();
                 $data = array('id_kategori' => $kat, 'kode' => $kode, 'menu' => $menu, 'harga' => $harga, 'file' => $f['orig_name'], 'ket' => $ket);
             }
         } else {
             $data = array('id_kategori' => $kat, 'kode' => $kode, 'menu' => $menu, 'harga' => $harga, 'ket' => $ket);
         }
         crud::simpan('tbl_menu', $data);
         $this->session->set_flashdata('menu', '<div class="alert alert-success">Data menu sudah disimpan !!!</div>');
         redirect('page=menu&act=menu_tambah');
     }
 }
開發者ID:mikhaelfelian,項目名稱:PROJECT-RESTO-TIGERA,代碼行數:45,代碼來源:menu.php

示例4: meja_simpan

 public function meja_simpan()
 {
     $meja = $this->input->post('meja');
     $folder = realpath('../assets/foto/meja/');
     $file = $_FILES['file']['name'];
     $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
     $this->form_validation->set_rules('meja', 'Meja', 'required');
     if ($this->form_validation->run() == FALSE) {
         $msg_error = array('meja' => form_error('meja'));
         $has_error = array('meja' => 'has-error');
         $this->session->set_flashdata('form_error', $msg_error);
         $this->session->set_flashdata('has_error', $has_error);
         redirect('page=meja&act=meja_tambah');
     } else {
         if (!empty($file)) {
             // Konfigurasi upload gambar
             $config['upload_path'] = $folder;
             $config['allowed_types'] = 'jpg|png';
             $config['max_size'] = '4096';
             $config['remove_spaces'] = TRUE;
             $config['file_name'] = 'meja_' . strtolower($meja);
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload('file')) {
                 $this->session->set_flashdata('meja', 'Error : <b>' . $this->upload->display_errors() . '</b>.');
                 redirect('page=meja&act=meja_tambah');
             } else {
                 $f = $this->upload->data();
                 $data = array('no_meja' => $meja, 'foto' => $f['orig_name'], 'status' => '0');
             }
         } else {
             $data = array('no_meja' => $meja, 'status' => '0');
         }
         crud::simpan('tbl_meja', $data);
         $this->session->set_flashdata('meja', '<div class="alert alert-succeded">Data meja sudah disimpan !!!</div>');
         redirect('page=meja&act=meja_tambah');
     }
 }
開發者ID:mikhaelfelian,項目名稱:PROJECT-RESTO-TIGERA,代碼行數:37,代碼來源:meja.php


注:本文中的crud::simpan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。