Welcome Guest, Not a member yet? Register   Sign In
Can't show product from db by id
#1

[eluser]mirag3[/eluser]
Hi a have a problem, i cant show product by id.

I have connected db and loaded database library. Structure of table products: id_product, name, label.

Product(controler).php:

class Product extends CI_Controller {

public function show_product($id_product)
{
$this->load->model('product_model');
$data['product'] = $this->product_model->Show_product();
$this->load->view('product_view', $data);
}
}

Product_view:

<?= $obj->name ?>
<?= $obj->id_product ?>
<?= $obj->label ?>

Product_model:


class Product_model extends CI_Model {

function Show_product()
{
$data['id_product']
$q = $this->db->get('products');

return $q->result();
}

}

I have to url as http://localhost/shop/product/$id , how must be routing?

Im newbie in codeigniter, help please.
Thanks


Messages In This Thread
Can't show product from db by id - by El Forum - 04-01-2012, 09:59 AM
Can't show product from db by id - by El Forum - 04-01-2012, 04:42 PM
Can't show product from db by id - by El Forum - 04-01-2012, 09:50 PM
Can't show product from db by id - by El Forum - 04-01-2012, 10:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB