[eluser]solid9[/eluser]
Hi guys
I have this small error below,
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: org
Filename: controllers/prod_c.php
Line Number: 27
controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Prod_c extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('form');
$this->load->helper('html');
$this->load->model('prod_m');
}
//fetch all product records
//display all records to prod_show.php
//http://herpescureresearch.org/researchers/prod_c/prod_show/
function prod_show() {
$data['rows'] = $this->prod_m->getAll();
$this->load->view('prod_show', $data);
}
function prod_edit() {
//capture url
$prod_name = $this->uri->segment(3, 0);
$query = $this->prod_m->getProduct($prod_name);
$data['prod_name'] = $query['prod_name'];
$data['org'] = $query['org'];
$this->load->view('prod_edit_form',$data);
}
function prod_delete() {
$prod_name = $this->uri->segment(3, 0);
}
function prod_success() {
}
}
/* End of file prod_c.php */
/* Location: ./application/controllers/prod_c.php */
model:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Prod_m extends CI_Model {
function getAll() {
$this->db->select('prod_name');
$this->db->from('products');
//$this->db->where('id', 1);
$q = $this->db->get();
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function getProduct($prod_name){
$this->db->select('prod_name');
$this->db->from('products');
$this->db->where('prod_name', $prod_name);
$query = $this->db->get();
if($query->num_rows() > 0) {
return $query->row_array();
}
}
}
/* End of file prod_m.php */
/* Location: ./application/model/prod_m.php */
What am I missing here?
Thanks in advanced.