• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help on converting mysql query to codeigniter active record

#1
Code:
SELECT date(`timestamp`)
     , COUNT(`odr_id`) AS num_sales
     , SUM(`amnt_paid`) AS daily_total
     , SUM(gov_fee) as e_pay
     , SUM(items_total) as sum_tot_cost
  FROM item_table
GROUP
    BY date(`timestamp`)
where ('user', $this->session->userdata('usernm'));

I get the username as table column and throws error saying "column not found"
Reply

#2
@jollytsr,

Have you tried running this query directly in MySQL and seeing if it works correctly?
Reply

#3
(04-13-2021, 06:54 AM)php_rocs Wrote: @jollytsr,

Have you tried running this query directly in MySQL and seeing if it works correctly?

@php_rocs

Thanks for your kind reply.

I have tried in mysql. It works perfectly. But unable to use it in codeIgniter.
Reply

#4
@ jollytsr,

Can we see the code how you have it exactly in CI (line for line)?
Reply

#5
(04-15-2021, 07:25 AM)php_rocs Wrote: @ jollytsr,

Can we see the code how you have it exactly in CI (line for line)?

Hello, send the way you set up the query using codeigniter(https://www.codeigniter.com/userguide3/d...ilder.html).
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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