codeigniter - I am getting mysql error check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 4 -
i getting sql error "you have error in sql syntax; check manual corresponds mysql server version right syntax use near '?' @ line 4
select cm.user_id, chat_message_content, u.firstname chat_message cm join user u on cm.user_id = u.user_id cm.chat_id= ?"
model
function get_chat_messages($chat_id) { $query_str = "select cm.user_id, chat_message_content, u.firstname chat_message cm join user u on cm.user_id = u.user_id cm.chat_id= ?"; $results = $this->db->query($query_str, $chat_id); return $results; }
try putting quotes around question mark if it's value in database you're filtering by:
$query_str = "select cm.user_id, chat_message_content, u.firstname chat_message cm join user u on cm.user_id = u.user_id cm.chat_id= '?'";
Comments
Post a Comment