Help with Binding |
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.
@Shamunda,
Here is the link to the user guide that will assist you. https://www.codeigniter.com/user_guide/d...eries.html
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); (09-13-2017, 03:11 AM)ktmonty Wrote: Hope this work. 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. |
Welcome Guest, Not a member yet? Register Sign In |