Wolfsblvt / mentions

Allows users to mention other users in posts. If a user is mentioned, he will recieve a notification unless he deactivated this notification. Meantioned usernames can be automatically colored in their username color. Mentioned users will be autosuggested.
GNU General Public License v2.0
13 stars 17 forks source link

Some sql queries not working with MSSQL #24

Open Wolfsblvt opened 9 years ago

Wolfsblvt commented 9 years ago

Mentioned here: https://www.phpbb.com/community/viewtopic.php?p=14003031#p14003031

The query where the error occured is here: https://github.com/Wolfsblvt/mentions/blob/master/ext.php#L91-L93

bantu commented 9 years ago

Try using single quotes around SQL strings.

    $sql = 'SELECT bbcode_id
FROM ' . BBCODES_TABLE . "
WHERE bbcode_tag = 'mention' OR bbcode_tag = 'mention='";
Wolfsblvt commented 9 years ago

Thank you for that tip. Single quotation marks seems to be working for MSSQL. Let's hope it is working in all other dbms systems as well. Thank you, @bantu.

iMattPro commented 9 years ago

May be better to consider using sql_in_set instead.

'WHERE ' . $this->db->sql_in_set('bbcode_tag', array('mention', 'mention='));
Wolfsblvt commented 9 years ago

Even better, agreed.