[eluser]Unknown[/eluser]
Sorry if this is not the place to post this, but I really need your help.
I've been getting a lot of undefined index errors from my model and I don't know why.
This is the code:
Code:
function get_items(){
$dynamiclist = "";
$query = $this->db->query('SELECT id FROM products');
$productCount = $query->num_rows();
if($productCount > 0){
foreach($query->result_array() as $row){
$id= $row["id"];
$product_name= $row["product_name"]; //error
$price = $row["price"]; //error
$category = $row["category"]; //error
$subcategory = $row["subcategory"]; //error
$details = $row["details"]; //error
$date_added = $row["date_added"]; //error
...
Basically, I get errors for those variables I have marked.
Can anyone enlighten me?