• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

i really confused how to insert with joining 3 table and how to show it, i want to make some article this article cant be modified by another user and how to insert according user insert and just thats user can edit the article who build that... im sorry for my bad english

this my database and i using codeigniter to make this website

this my addpost.php i know is the wrong code

user table

post table

city table

thanks im sorry cause i confused to joining or showing like thats, i hope you can help me guys, thanks

 `$this->db->select('*');     $this->db->from('postfes');     $this->db->join('daerah', 'daerah.id=postfes.daerah_id');     $this->db->join('user', 'user.id=postfes.email_id');     $this->db->where($data);     $query = $this->db->get();     return $query->result(); 

thats my model code

public function addpost() {     $data['title'] = 'Add Posting';     $data['user'] = $this->db->get_where('user', ['email' => $this->session->userdata('email')])->row_array();       $data['nm_daerah'] = $this->db->get('daerah')->result_array();     $this->load->model('PostModel', 'post');     $data['postFes'] = $this->post->getPostModel4();       $this->form_validation->set_rules('namaFes', 'Nama Festival', 'required|trim');     $this->form_validation->set_rules('daerah_id', 'Nama Daerah', 'required|trim');     $this->form_validation->set_rules('tanggal', 'Tanggal', 'required|trim');     $this->form_validation->set_rules('deskripsi', 'Deskripsi', 'required|trim');      if ($this->form_validation->run() == false) {          $this->load->view('templates/user-header', $data);         $this->load->view('templates/user-sidebar', $data);         $this->load->view('templates/user-topbar', $data);         $this->load->view('user/addpost', $data);         $this->load->view('templates/user-footer');     } else {          $namaFes = $this->input->post('namaFes');         $daerah = $this->input->post('daerah_id');         $tanggal = $this->input->post('tanggal');         $desk = $this->input->post('deskripsi');         $idpost = $this->session->set_userdata(array($data => $data['id']));         $image = $_FILES['image'];         if ($image = '') {         } else {             $config['upload_path'] = './assets/img/posting/';             $config['allowed_types'] = 'jpg|gif|png|jpeg';              $this->load->library('upload', $config);             if (!$this->upload->do_upload('image')) {                 echo 'failed upload image';                 die();             } else {                 $image = $this->upload->data('file_name');             }         }          $data = [             'namaFes' => $namaFes,             'daerah_id' => $daerah,             'tanggal' => $tanggal,             'deskripsi' => $desk,             'email_id' => $idpost,             'image' => $image         ];          $this->db->insert('postfes', $data);         $this->session->set_flashdata('message', '');         redirect('user/addpost');     } } 

that's my addpost function code

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]