How to display data only once by using two different tables in codeigniter
up vote
1
down vote
favorite
I am preparing register that input from date and to date...That display the entries made by the user from date and to date...I want to display voucher no,billdate,qty,amount(present in purchase bill table) and product name(present in purchaseitem table) i want to print the product name on the same row according to the billno..(For this i am using group concat)...My problem is all the datas are displaying multiple times..I don't know where is the error in my code..What changes have to be done on my code to display the data only once..Below i have attached my code..Help me
Controller Code:
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->select('GROUP_CONCAT(Prdtname)as itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query = $this->db->get('')->result_array();
$data ['query']= $query;
View code:
<?php $rowcount = 1 ?>
<?php foreach ($query as $row): ?>
<tr>
<td><?=$rowcount;?></td>
<td><?=$row['voucherno'];?></td>
<td><?=$row['date'];?></td>
<td><?=$row['PName'];?></td>
<td><?=$row['sqty'];?></td>
<td><?=$row['billtot'];?></td>
<td><?=$row['itemname'];?></td>
<?php $rowcount +=1?>
<br>
<?php endforeach ?>
</tr>
I think the datas are printing multiple times because i have used two queries but passed on the same variable $data..Is there is any possibility to load multiple query result on the same view page..???
php mysql codeigniter group-concat
New contributor
|
show 4 more comments
up vote
1
down vote
favorite
I am preparing register that input from date and to date...That display the entries made by the user from date and to date...I want to display voucher no,billdate,qty,amount(present in purchase bill table) and product name(present in purchaseitem table) i want to print the product name on the same row according to the billno..(For this i am using group concat)...My problem is all the datas are displaying multiple times..I don't know where is the error in my code..What changes have to be done on my code to display the data only once..Below i have attached my code..Help me
Controller Code:
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->select('GROUP_CONCAT(Prdtname)as itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query = $this->db->get('')->result_array();
$data ['query']= $query;
View code:
<?php $rowcount = 1 ?>
<?php foreach ($query as $row): ?>
<tr>
<td><?=$rowcount;?></td>
<td><?=$row['voucherno'];?></td>
<td><?=$row['date'];?></td>
<td><?=$row['PName'];?></td>
<td><?=$row['sqty'];?></td>
<td><?=$row['billtot'];?></td>
<td><?=$row['itemname'];?></td>
<?php $rowcount +=1?>
<br>
<?php endforeach ?>
</tr>
I think the datas are printing multiple times because i have used two queries but passed on the same variable $data..Is there is any possibility to load multiple query result on the same view page..???
php mysql codeigniter group-concat
New contributor
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Useecho $this->db->last_query();
after your$query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.
– Davo
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How doespurchasebill
links withpurchaseitem
.
– Davo
2 days ago
|
show 4 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am preparing register that input from date and to date...That display the entries made by the user from date and to date...I want to display voucher no,billdate,qty,amount(present in purchase bill table) and product name(present in purchaseitem table) i want to print the product name on the same row according to the billno..(For this i am using group concat)...My problem is all the datas are displaying multiple times..I don't know where is the error in my code..What changes have to be done on my code to display the data only once..Below i have attached my code..Help me
Controller Code:
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->select('GROUP_CONCAT(Prdtname)as itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query = $this->db->get('')->result_array();
$data ['query']= $query;
View code:
<?php $rowcount = 1 ?>
<?php foreach ($query as $row): ?>
<tr>
<td><?=$rowcount;?></td>
<td><?=$row['voucherno'];?></td>
<td><?=$row['date'];?></td>
<td><?=$row['PName'];?></td>
<td><?=$row['sqty'];?></td>
<td><?=$row['billtot'];?></td>
<td><?=$row['itemname'];?></td>
<?php $rowcount +=1?>
<br>
<?php endforeach ?>
</tr>
I think the datas are printing multiple times because i have used two queries but passed on the same variable $data..Is there is any possibility to load multiple query result on the same view page..???
php mysql codeigniter group-concat
New contributor
I am preparing register that input from date and to date...That display the entries made by the user from date and to date...I want to display voucher no,billdate,qty,amount(present in purchase bill table) and product name(present in purchaseitem table) i want to print the product name on the same row according to the billno..(For this i am using group concat)...My problem is all the datas are displaying multiple times..I don't know where is the error in my code..What changes have to be done on my code to display the data only once..Below i have attached my code..Help me
Controller Code:
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->select('GROUP_CONCAT(Prdtname)as itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query = $this->db->get('')->result_array();
$data ['query']= $query;
View code:
<?php $rowcount = 1 ?>
<?php foreach ($query as $row): ?>
<tr>
<td><?=$rowcount;?></td>
<td><?=$row['voucherno'];?></td>
<td><?=$row['date'];?></td>
<td><?=$row['PName'];?></td>
<td><?=$row['sqty'];?></td>
<td><?=$row['billtot'];?></td>
<td><?=$row['itemname'];?></td>
<?php $rowcount +=1?>
<br>
<?php endforeach ?>
</tr>
I think the datas are printing multiple times because i have used two queries but passed on the same variable $data..Is there is any possibility to load multiple query result on the same view page..???
php mysql codeigniter group-concat
php mysql codeigniter group-concat
New contributor
New contributor
edited 2 days ago
New contributor
asked 2 days ago
dhara
266
266
New contributor
New contributor
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Useecho $this->db->last_query();
after your$query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.
– Davo
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How doespurchasebill
links withpurchaseitem
.
– Davo
2 days ago
|
show 4 more comments
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Useecho $this->db->last_query();
after your$query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.
– Davo
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How doespurchasebill
links withpurchaseitem
.
– Davo
2 days ago
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Use
echo $this->db->last_query();
after your $query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.– Davo
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Use
echo $this->db->last_query();
after your $query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.– Davo
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How does
purchasebill
links with purchaseitem
.– Davo
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How does
purchasebill
links with purchaseitem
.– Davo
2 days ago
|
show 4 more comments
2 Answers
2
active
oldest
votes
up vote
0
down vote
Yes, you can execute different queries and pass them individually to the view:
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query1 = $this->db->get()->result_array();
$this->db->select('GROUP_CONCAT(Prdtname) AS itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query2 = $this->db->get()->result_array();
$data['bills']= $query1;
$data['items']= $query2;
$this->load->view('your_view_path', $data);
Then on your view, you can access the data in $bills
and $items
. My advice is that you play around and create just one query that brings all your information.
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to$query1
, where are you getting this error? in your view?
– Davo
13 hours ago
add a comment |
up vote
0
down vote
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('purchasebill.*,GROUP_CONCAT(parmaster.Prdtname)as itemname');
$this->db->from('purchasebill');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$query = $this->db->get()->result_array();
$data ['query']= $query;
getting this error Not unique table/alias: 'purchasebill' SELECTpurchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOINparmaster
ONparmaster
.Pcode
=purchasebill
.partyname
LEFT OUTER JOINpurchasebill
ONpurchasebill
.date
=purchaseitem
.billdate
WHEREdate
>= '2018-11-09' ANDdate
<= '2018-11-12' GROUP BYvno
,billno
ORDER BYvno
asc
– dhara
15 hours ago
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Yes, you can execute different queries and pass them individually to the view:
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query1 = $this->db->get()->result_array();
$this->db->select('GROUP_CONCAT(Prdtname) AS itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query2 = $this->db->get()->result_array();
$data['bills']= $query1;
$data['items']= $query2;
$this->load->view('your_view_path', $data);
Then on your view, you can access the data in $bills
and $items
. My advice is that you play around and create just one query that brings all your information.
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to$query1
, where are you getting this error? in your view?
– Davo
13 hours ago
add a comment |
up vote
0
down vote
Yes, you can execute different queries and pass them individually to the view:
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query1 = $this->db->get()->result_array();
$this->db->select('GROUP_CONCAT(Prdtname) AS itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query2 = $this->db->get()->result_array();
$data['bills']= $query1;
$data['items']= $query2;
$this->load->view('your_view_path', $data);
Then on your view, you can access the data in $bills
and $items
. My advice is that you play around and create just one query that brings all your information.
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to$query1
, where are you getting this error? in your view?
– Davo
13 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
Yes, you can execute different queries and pass them individually to the view:
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query1 = $this->db->get()->result_array();
$this->db->select('GROUP_CONCAT(Prdtname) AS itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query2 = $this->db->get()->result_array();
$data['bills']= $query1;
$data['items']= $query2;
$this->load->view('your_view_path', $data);
Then on your view, you can access the data in $bills
and $items
. My advice is that you play around and create just one query that brings all your information.
Yes, you can execute different queries and pass them individually to the view:
$this->db->select('*');
$this->db->from('purchasebill');
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->order_by("voucherno", "asc");
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$query1 = $this->db->get()->result_array();
$this->db->select('GROUP_CONCAT(Prdtname) AS itemname',false);
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$this->db->from('purchaseitem');
$query2 = $this->db->get()->result_array();
$data['bills']= $query1;
$data['items']= $query2;
$this->load->view('your_view_path', $data);
Then on your view, you can access the data in $bills
and $items
. My advice is that you play around and create just one query that brings all your information.
answered 2 days ago
Davo
41437
41437
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to$query1
, where are you getting this error? in your view?
– Davo
13 hours ago
add a comment |
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to$query1
, where are you getting this error? in your view?
– Davo
13 hours ago
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
getting error..undefined variable query1 and invalid argument supplied foreach
– dhara
23 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
I am trying to achieve this through one query but i don't know how to fetch two datas from two different table..
– dhara
22 hours ago
If you're getting undefined query1 you need to debug what's being returned to
$query1
, where are you getting this error? in your view?– Davo
13 hours ago
If you're getting undefined query1 you need to debug what's being returned to
$query1
, where are you getting this error? in your view?– Davo
13 hours ago
add a comment |
up vote
0
down vote
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('purchasebill.*,GROUP_CONCAT(parmaster.Prdtname)as itemname');
$this->db->from('purchasebill');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$query = $this->db->get()->result_array();
$data ['query']= $query;
getting this error Not unique table/alias: 'purchasebill' SELECTpurchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOINparmaster
ONparmaster
.Pcode
=purchasebill
.partyname
LEFT OUTER JOINpurchasebill
ONpurchasebill
.date
=purchaseitem
.billdate
WHEREdate
>= '2018-11-09' ANDdate
<= '2018-11-12' GROUP BYvno
,billno
ORDER BYvno
asc
– dhara
15 hours ago
add a comment |
up vote
0
down vote
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('purchasebill.*,GROUP_CONCAT(parmaster.Prdtname)as itemname');
$this->db->from('purchasebill');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$query = $this->db->get()->result_array();
$data ['query']= $query;
getting this error Not unique table/alias: 'purchasebill' SELECTpurchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOINparmaster
ONparmaster
.Pcode
=purchasebill
.partyname
LEFT OUTER JOINpurchasebill
ONpurchasebill
.date
=purchaseitem
.billdate
WHEREdate
>= '2018-11-09' ANDdate
<= '2018-11-12' GROUP BYvno
,billno
ORDER BYvno
asc
– dhara
15 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('purchasebill.*,GROUP_CONCAT(parmaster.Prdtname)as itemname');
$this->db->from('purchasebill');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$query = $this->db->get()->result_array();
$data ['query']= $query;
$this->db->where('date >=', $newDate);
$this->db->where('date <=', $newDate2);
$this->db->select('purchasebill.*,GROUP_CONCAT(parmaster.Prdtname)as itemname');
$this->db->from('purchasebill');
$this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
$this->db->order_by('vno','asc');
$this->db->group_by('vno,billno');
$query = $this->db->get()->result_array();
$data ['query']= $query;
answered 16 hours ago
Vijay Makwana
461320
461320
getting this error Not unique table/alias: 'purchasebill' SELECTpurchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOINparmaster
ONparmaster
.Pcode
=purchasebill
.partyname
LEFT OUTER JOINpurchasebill
ONpurchasebill
.date
=purchaseitem
.billdate
WHEREdate
>= '2018-11-09' ANDdate
<= '2018-11-12' GROUP BYvno
,billno
ORDER BYvno
asc
– dhara
15 hours ago
add a comment |
getting this error Not unique table/alias: 'purchasebill' SELECTpurchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOINparmaster
ONparmaster
.Pcode
=purchasebill
.partyname
LEFT OUTER JOINpurchasebill
ONpurchasebill
.date
=purchaseitem
.billdate
WHEREdate
>= '2018-11-09' ANDdate
<= '2018-11-12' GROUP BYvno
,billno
ORDER BYvno
asc
– dhara
15 hours ago
getting this error Not unique table/alias: 'purchasebill' SELECT
purchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOIN parmaster
ON parmaster
.Pcode
= purchasebill
.partyname
LEFT OUTER JOIN purchasebill
ON purchasebill
.date
= purchaseitem
.billdate
WHERE date
>= '2018-11-09' AND date
<= '2018-11-12' GROUP BY vno
, billno
ORDER BY vno
asc– dhara
15 hours ago
getting this error Not unique table/alias: 'purchasebill' SELECT
purchaseitem
.*, GROUP_CONCAT(parmaster.Prdtname)as itemname FROM (purchasebill
) LEFT OUTER JOIN parmaster
ON parmaster
.Pcode
= purchasebill
.partyname
LEFT OUTER JOIN purchasebill
ON purchasebill
.date
= purchaseitem
.billdate
WHERE date
>= '2018-11-09' AND date
<= '2018-11-12' GROUP BY vno
, billno
ORDER BY vno
asc– dhara
15 hours ago
add a comment |
dhara is a new contributor. Be nice, and check out our Code of Conduct.
dhara is a new contributor. Be nice, and check out our Code of Conduct.
dhara is a new contributor. Be nice, and check out our Code of Conduct.
dhara is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239207%2fhow-to-display-data-only-once-by-using-two-different-tables-in-codeigniter%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you show how you're passing the $data array to the view and also your view code?
– Davo
2 days ago
Yeah sure...check on my edited post
– dhara
2 days ago
Ok, so your view looks fine. I'm almost completely sure the problem is in the query, have you tried your query on PhpMyAdmin or similar?. Use
echo $this->db->last_query();
after your$query = $this->db->get('')->result_array();
line and then copy that line and try directly on the database, you may be getting duplicated rows there.– Davo
2 days ago
Yeah sir..I tried groupconcat in phpmy admin there it works fine..Is there is any possibility to load two query results on the same view page because for both of the table i am using $query and pass it on data
– dhara
2 days ago
Now that I see, your sql query builder looks wrong, there's 2 selects and no clear way on how they should be executed. You can totally separate those queries, but first let's make sure you find the right SQL query. How does
purchasebill
links withpurchaseitem
.– Davo
2 days ago