Gan mohon bantuannya. ini kenapa ya kok malah error saat Edit Data

ini keterangan errornya:

A PHP Error was encountered Severity: Warning

Message: getimagesize(C:/xampp/htdocs/web_puskesmas/foto_pegawai): Failed to open stream: Permission denied

Filename: libraries/Image_lib.php

Line Number: 1655

Backtrace:

File: C:\xampp\htdocs\web_puskesmas\application\controllers\Setting.php Line: 80 Function: library

File: C:\xampp\htdocs\web_puskesmas\index.php Line: 315 Function: require_once

A Database Error Occurred Error Number: 1054

Unknown column 'id1' in 'where clause'

UPDATE tlb_setting SET id = '1', nama_puskesmas = 'UPTD Puskesmas Tanjung Satai', email_puskesmas = 'pusk.tanjungsatai@gmail.com', alamat = 'Jln. Merdeka Tanjung Satai No. 20 Desa Tanjung Satai kode pos 78858 ', nama_kapus = NULL WHERE id1 IS NULL

Filename: C:/xampp/htdocs/web_puskesmas/system/database/DB_driver.php

Line Number: 665

ini cotroller ediya

public function edit($id)
    {
        $this->form_validation->set_rules('nama_puskesmas', 'Nama Puskesmas', 'required');

        if ($this->form_validation->run() == TRUE) {
            $config['upload_path']          = './foto_pegawai/';
            $config['allowed_types']        = 'gif|jpg|png|jpeg';
            $config['max_size']             = 5000;
            $this->upload->initialize($config);
            if (! $this->upload->do_upload('fhoto_kapus')) {

                $data = array(
                    'title2'    => 'UPTD Puskesmas Tanjung Satai',
                    'title'     => 'Edit Profil Puskesmas',
                    'error'     => $this->upload->display_errors(),
                    'setting'   => $this->m_setting->detail($id),

                );

                $this->load->view('template/back-end/v_head', $data);
                $this->load->view('template/back-end/v_nav', $data);
                $this->load->view('template/back-end/sidebar', $data);
                $this->load->view('setting/v_edit', $data);
                $this->load->view('template/back-end/v_footer');
            } else {
                // menghapus file Foto Lama
                $setting = $this->m_setting->detail($id);
                if ($setting->fhoto_kapus != "") {
                    unlink('./foto_pegawai/' . $setting->fhoto_kapus);
                }
                // end menghapus foto

                $upload_data                = array('uploads' => $this->upload->data());
                $config['image_library']    = 'gd2';
                $config['source_image']     = './foto_pegawai/' . $upload_data['uploads']['file_name'];
                $this->load->library('image_lib', $config);

                $data = array(
                    'id'            => $id,
                    'nama_puskesmas'  => $this->input->post('nama_puskesmas'),
                    'email_puskesmas'  => $this->input->post('email_puskesmas'),
                    'alamat'  => $this->input->post('alamat'),
                    'nama_kapus'  => $this->input->post('nama_kapus'),
                    'fhoto_kapus'  => $upload_data['uploads']['file_name']
                );
                $this->m_setting->edit($data);
                $this->session->set_flashdata('message', '<div class="alert alert-info alert-dismissible"><b> Data Pegawai Berhasil di Ubah!!! </b> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>', '</div>');
                redirect('setting');
            }
            $upload_data                = array('uploads' => $this->upload->data());
            $config['image_library']    = 'gd2';
            $config['source_image']     = './foto_pegawai/' . $upload_data['uploads']['file_name'];
            $this->load->library('image_lib', $config);

            $data = array(
                'id'            => $id,
                'nama_puskesmas'  => $this->input->post('nama_puskesmas'),
                'email_puskesmas'  => $this->input->post('email_puskesmas'),
                'alamat'  => $this->input->post('alamat'),
                'nama_kapus'  => $this->input->post('nama_kapus')


            );
            $this->m_setting->edit($data);
            $this->session->set_flashdata('message', '<div class="alert alert-info alert-dismissible"><b> Data Pegawai Berhasil di Ubah!!! </b> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>', '</div>');
            redirect('setting');
        }
        $data = array(
            'title2'    => 'UPTD Puskesmas Tanjung Satai',
            'title'     => 'Edit Data Profile Puskesmas',
            'setting'   => $this->m_setting->detail($id),

        );
        $this->load->view('template/back-end/v_head', $data);
        $this->load->view('template/back-end/v_nav', $data);
        $this->load->view('template/back-end/sidebar', $data);
        $this->load->view('setting/v_edit', $data);
        $this->load->view('template/back-end/v_footer');
    }

dan juga aku itu mau update. bukan nampilkan data. ini code modelnya nya dibawah.

<?php defined('BASEPATH') or exit('No direct script access allowed'); class M_setting extends CI_Model { public function lists() { $this->db->select('*'); $this->db->from('tlb_setting'); $this->db->order_by('id'); return $this->db->get()->result(); }

public function detail($id)
{

    $this-&gt;db-&gt;select(&#039;*&#039;);
    $this-&gt;db-&gt;from(&#039;tlb_setting&#039;);
    $this-&gt;db-&gt;where(&#039;id&#039;, $id);
    return $this-&gt;db-&gt;get()-&gt;row();
}

public function edit($data)
{
    $this-&gt;db-&gt;where(&#039;id&#039; . $data[&#039;id&#039;]);
    $this-&gt;db-&gt;update(&#039;tlb_setting&#039;, $data);
}

}

ini viewnya :

<section class="content"> <div class="container-fluid"> <div class="card card-primary card-outline"> <div class="row my-5 mr-3 ml-3"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <?php echo validation_errors('<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>', '</div>');

                                            if (isset($error_upload)) {
                                                echo &#039;&lt;div class=&quot;alert alert-success alert-dismissible&quot;&gt;
                                    &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot; aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/button&gt;&#039; . $error_upload . &#039;&lt;/div&gt;&#039;;
                                            }
                                            echo form_open_multipart(&#039;setting/edit/&#039; . $setting-&gt;id);
                                            ?&gt;
                                            &lt;div class=&quot;form-group row&quot;&gt;
                                                &lt;label class=&quot;col-sm-3 col-form-label&quot;&gt;Nama Puskesmas&lt;/label&gt;
                                                &lt;div class=&quot;col-sm-9&quot;&gt;
                                                    &lt;input class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;nama_puskesmas&quot; value=&quot;&lt;?= $setting-&gt;nama_puskesmas ?&gt;&quot; placeholder=&quot;Nama Puskesmas&quot; required&gt;
                                                &lt;/div&gt;
                                            &lt;/div&gt;
                                            &lt;div class=&quot;form-group row&quot;&gt;
                                                &lt;label class=&quot;col-sm-3 col-form-label&quot;&gt;Email Puskesmas&lt;/label&gt;
                                                &lt;div class=&quot;col-sm-9&quot;&gt;
                                                    &lt;input class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;email_puskesmas&quot; value=&quot;&lt;?= $setting-&gt;email_puskesmas ?&gt;&quot; placeholder=&quot;Email Puskesmas&quot; required&gt;
                                                &lt;/div&gt;
                                            &lt;/div&gt;

                                            &lt;div class=&quot;form-group row&quot;&gt;
                                                &lt;label class=&quot;col-sm-3 col-form-label&quot;&gt;Alamat&lt;/label&gt;
                                                &lt;div class=&quot;col-sm-9&quot;&gt;
                                                    &lt;textarea class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;alamat&quot; placeholder=&quot;Alamat Puskesmas&quot; required&gt;&lt;?= $setting-&gt;alamat ?&gt;&lt;/textarea&gt;
                                                &lt;/div&gt;
                                            &lt;/div&gt;

                                            &lt;div class=&quot;form-group row&quot;&gt;
                                                &lt;label class=&quot;col-sm-3 col-form-label&quot;&gt;Kepala Puskesmas&lt;/label&gt;
                                                &lt;div class=&quot;col-sm-9&quot;&gt;
                                                    &lt;input class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;kepala_puskesmas&quot; value=&quot;&lt;?= $setting-&gt;nama_kapus ?&gt;&quot; placeholder=&quot;Nama Kepala Puskesmas&quot; required&gt;
                                                &lt;/div&gt;
                                            &lt;/div&gt;
                                            &lt;div class=&quot;form-group row&quot;&gt;
                                                &lt;label class=&quot;col-sm-3 col-form-label&quot;&gt;Fhoto Kepala&lt;/label&gt;
                                                &lt;div class=&quot;col-sm-9&quot;&gt;
                                                    &lt;input class=&quot;form-control&quot; type=&quot;file&quot; name=&quot;foto_kapus&quot;&gt;
                                                &lt;/div&gt;
                                            &lt;/div&gt;
                                            &lt;button type=&quot;reset&quot; class=&quot;btn btn-danger float-right&quot;&gt;Reset&lt;/button&gt;
                                            &lt;button type=&quot;submit&quot; class=&quot;btn btn-info float-right mr-2&quot;&gt;Simpan&lt;/button&gt;
                                            &lt;?php form_close(); ?&gt;
                                        &lt;/div&gt;

                                    &lt;/div&gt;

                                &lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;&lt;!-- /.container-fluid --&gt;
                &lt;/section&gt;
                &lt;!-- /.content --&gt;
avatar Hiyar
@Hiyar

1 Kontribusi 0 Poin

Dipost 1 bulan yang lalu

Tanggapan

perhatikan "aturan main" saat membuat judul

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban