PDA

View Full Version : MySQL Query not working


Andr? Noberto
09-10-2015, 02:31 AM
Hello guys, I'm using the following code to get userid and other stuff from database but everytime a special character like "TM" appears, the query doesn't return any result.

$db->query_read("SELECT userid, avatarid, avatarrevision FROM " . TABLE_PREFIX . "user WHERE username = 'LeO?'");

Can you help me with this?

Thanks in advance.

PinkMilk
09-11-2015, 03:59 AM
Try & #153; (no space) instead of ™, also run query from phpmyadmin search for partial matches of "LeO" and see how the database has re-encoded the ™

ForceHSS
09-11-2015, 04:42 AM
Why not look at the members profile from admincp to find out his userid

Zachery
09-11-2015, 09:53 AM
Can you show us the rest of this code you're using? You might be able to better construct the query.

kh99
09-11-2015, 12:16 PM
I suspect that it's a character encoding issue, but I don't know much about handling that kind of thing. I did find this page: https://dev.mysql.com/doc/refman/5.0/en/charset-literal.html, so maybe try

$db->query_read("SELECT userid, avatarid, avatarrevision
FROM " . TABLE_PREFIX . "user WHERE username = _latin1'LeO™'");



or maybe _utf8 in place of _latin1.

Andr? Noberto
09-11-2015, 01:55 PM
Thanks kh99, it worked.