Hello all,
I’m trying to have CI build a sql query to use with jquery jqgrid. My query string is as follows:
$sql_data = array(
$sidx,
$sord,
$start,
$limit
);
$sql = "SELECT * FROM livestock, ORDER BY ? ? LIMIT ? , ?";
$query = $this->db->query($sql, $sql_data);CI throws an error:
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 ‘ORDER BY ‘id’ ‘desc’ LIMIT 0 , ‘10’’ at line 1
SELECT * FROM livestock, ORDER BY ‘id’ ‘desc’ LIMIT 0 , ‘10’
There’s an error with the query. I’m thinking it has to do with ‘desc’, but I’m not exactly sure. What is wrong with the sql query and what would be the correct query string?
-Thanks,
Rich