Welcome Guest, Not a member yet? Register   Sign In
Activerecord strange/weird backticks and spaces (CI 1.7.3)
#1

[eluser]Unknown[/eluser]
Hello everyone!
I have a big problem that bothering me for a few days.
On dev machine, everything is ok. But when i put it on prod got this:
Code:
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'e m b e r s )' at line 1

SELECT ````` * FROM (````` m e m b e r s )

Log:
Code:
DEBUG - 2011-10-23 15:45:17 --> Config Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Hooks Class Initialized
DEBUG - 2011-10-23 15:45:17 --> URI Class Initialized
DEBUG - 2011-10-23 15:45:17 --> No URI present. Default controller set.
DEBUG - 2011-10-23 15:45:17 --> Router Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Output Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Input Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Global POST and COOKIE data sanitized
DEBUG - 2011-10-23 15:45:17 --> Language Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Loader Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Database Driver Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Controller Class Initialized
DEBUG - 2011-10-23 15:45:17 --> Model Class Initialized
DEBUG - 2011-10-23 15:45:17 --> DB Transaction Failure
ERROR - 2011-10-23 15:45:17 --> Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'e m b e r s )' at line 1
DEBUG - 2011-10-23 15:45:17 --> Language file loaded: language/english/db_lang.php

Controller and model are simple:
Controller members.php:
Code:
function index()
{
$this->load->model("members_model");
$data['members'] = $this->members_model->getMember();
$this->load->view('members_list', $data);
}

Model members_model.php:
Code:
function getMember() {
$this->db->select("*");
$this->db->from("members");
$q = $this->db->get();
if ($q->num_rows() > 0) {
  return $q->result();
} else {
  return false;
}
}

CI version is 1.7.3, PHP version is 5.1.2, Apache is 2.2.15.

I tried $this->db->select("*", false), to remove backticks from query, but then I got:
Code:
SELECT * FROM ( m e m b e r s )

What to do next?

I installed same prod server as virtual machine on my computer. And it works. No errors.
Google was not my friend this time. Sad

P.S. Sorry for my bad English.




Theme © iAndrew 2016 - Forum software by © MyBB