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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -