Welcome Guest, Not a member yet? Register   Sign In
Complex Query Works on CL and Not CI $db->query
#1

[eluser]smatakajr[/eluser]
Hey

I can run this

SELECT r.affiliates_id, r.amount_owed, r.currency, r.mp_id, s.status_title, s.status_desc FROM relationships r JOIN status s ON (s.status_id = r.status_id) JOIN affiliates a ON (a.affiliates_id = r.affiliates_id) WHERE r.mp_id=60 AND (a.name LIKE "%rick%" OR a.email_address LIKE "%rick%" OR a.state LIKE "%rick%" OR a.paypal LIKE "%rick%" OR a.zip LIKE "%rick%" OR a.phone LIKE "%rick%" OR a.clickbank_id LIKE "%rick%" OR a.pdc_id LIKE "%rick%")

and the query works on the command line.. but when i run it through CI
$db->query() i get


An Error Was Encountered

Error Number: 1096

No tables used

SELECT *

What can do to figure out why?

any help is appreciated

Thank You
Rick
#2

[eluser]TheFuzzy0ne[/eluser]
It's almost like it doesn't see the FROM clause. My suggestion would be to escape the field names, and see if that helps.

Also, add this line into your constructor,
Code:
$this->output->enable_profiler(TRUE);
and see if your query has changed.
#3

[eluser]smatakajr[/eluser]
Cool Bro.. Im going to try!

Rick




Theme © iAndrew 2016 - Forum software by © MyBB