Welcome Guest, Not a member yet? Register   Sign In
Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work...
#28

[eluser]-sek[/eluser]
I do have some experience with quirks showing up in the latest CI

Sometimes Active Record does not like whitespace in queries. So if you wrote

Code:
$select = ' id, title, text ';
and passed it to $db->select($select)
it may fail unless the leading whitespace is removed

There are some other things, like compound statements and certain JOINs the AR would not accept.

Also, AR can give strange or no error when the table name is missing, so be sure you are specifying it.

A simple way to check is to enter a nonexistent column name into the query, then let CI display the SQL in the error message, copy and paste this into the SQL command line to see if the query actually runs. If it does, you know something is wrong in Active Record.

Code:
function GetPaymentRequests() {
    $this->db->select('users.*, payouts.amount, payouts.id as payout_id');
    $this->db->from('payouts');
    $this->db->join('users','payouts.user_id = users.id','INNER');
    $this->db->where('date_paid','0');
    $this->db->where('organization_id',0);
    $this->db->orderby('date_requested ASC');
    return $this->db->get();
  }

I do not see any obvious problems. I once had to rewrite a join AR would not run.


Messages In This Thread
Old CI install, recently upgraded PHP and MySQL, and now one query doesn’t work... - by El Forum - 04-21-2009, 04:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB