Hi all,
I having a problem passing values in a column according to the id of the product.
The join tables is running but returns all column values. I think the solution is simple but I am not able to get there. Please some help to solve this issue?
Here is the tables
TABLE: tbl_lining
id, article, description, observations
TABLE:products
[Table Products - picture] http://goo.gl/jjUXyy
Function used in model
MODEL
public function getliningsale($id)
{
$this->db->select('*');
$this->db->from('products');
$this->db->join('tbl_lining', 'products.lining=tbl_lining.id', 'left');
$this->db->where('products.id', $id); // Also mention table name here
$query = $this->db->get();
if($query->num_rows() > 0)
return $data->result();
}CONTROLLER
function liningsale()
{
$data['lining'] = $this->sales_model->getliningsale($id);
$this->load->view('add', $data);
}Trying to display one record according product id
VIEW
echo '<td><input class="span1 tran2" name="lining\\\\'+ count +\\\\'" type="text"';
echo 'value="';
foreach ($lining as $valor) {
echo $valor->article;
echo '-';
echo $valor->description;
echo '">';
}
echo '</td>';
Instead of that, is displaying all records
[Table Result - picture](http://goo.gl/BhHunM)
Can anyone please help me to solve this issue?