• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Binding

#1
I'm not familiar with CI but could someone provide me with a solution of how I would properly bind this query:

$ncCouponQuery = $this->db->query("select c.*,(select count(*) from coupon_analytics CA where CA.CouponID = c.ID ) as AdminCnt from coupon_master c group by c.ID");


Thank you.
Reply

#2
@Shamunda,
Here is the link to the user guide that will assist you. https://www.codeigniter.com/user_guide/d...eries.html
Reply

#3
Hope this work.
$ncCouponQuery = $this->db->select('*')
->from('coupon_master')
->group_by('coupon_master.ID')
->join('coupon_analytics','coupon_analytics.CouponID=coupon_master.ID')
->get()
->result();
$count= count($ncCouponQuery);
Reply

#4
(09-13-2017, 04:11 AM)ktmonty Wrote: Hope this work.
$ncCouponQuery = $this->db->select('*')
->from('coupon_master')
->group_by('coupon_master.ID')
->join('coupon_analytics','coupon_analytics.CouponID=coupon_master.ID')
->get()
->result();
$count= count($ncCouponQuery);

Thank very much. This is basically what I was looking for so I can use this as a template to work with more complex queries. The guide shows basic examples.

Again, thank you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.