ScrewLooseSalad Posted May 9, 2013 Share Posted May 9, 2013 I have a MySQL database of addresses that has worked well up to now, however adding an Irish address with a.... ' .... symbol in it has thrown it off completely, I can see why this would happen, but is there a simple solution to avoid this problem in future? I was thinking this must be a common enough problem for there to be a function to fix inputs or something, I noticed phpMyAdmin doubles up the symbol and the entry is entered correctly... Quote Link to comment https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/ Share on other sites More sharing options...
gizmola Posted May 9, 2013 Share Posted May 9, 2013 This depends on what database client library you are using (mysql, mysqli, pdo)? If you're using the old mysql_ functions then you should have been using mysql_real_escape_string() to escape all of your string input. Quote Link to comment https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/#findComment-1429350 Share on other sites More sharing options...
ScrewLooseSalad Posted May 10, 2013 Author Share Posted May 10, 2013 (edited) This depends on what database client library you are using (mysql, mysqli, pdo)? If you're using the old mysql_ functions then you should have been using mysql_real_escape_string() to escape all of your string input. I'm fairly certain that I've installed mysqli, I know I have installed it, as the warning flag that said it wasn't installed in phpMyAdmin dropped at the time I installed it; I've been using the mysql_ functions, do I understand correctly that mysqli functions have different names, and I will have to go back and change all my functions? Edited May 10, 2013 by ScrewLooseSalad Quote Link to comment https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/#findComment-1429461 Share on other sites More sharing options...
Irate Posted May 10, 2013 Share Posted May 10, 2013 If you're using mysqli, use the mysqli class... $mysqli = new mysqli(string $host, string $user, string $password [, string $database]);You can then call all relevant functions as methods of $mysqli, like $mysqli->query("SELECT * FROM table"); Just a suggestion. Quote Link to comment https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/#findComment-1429465 Share on other sites More sharing options...
ScrewLooseSalad Posted May 10, 2013 Author Share Posted May 10, 2013 If you're using mysqli, use the mysqli class... $mysqli = new mysqli(string $host, string $user, string $password [, string $database]);You can then call all relevant functions as methods of $mysqli, like $mysqli->query("SELECT * FROM table"); Just a suggestion. Wonderful, That almost seems a bit too straightforward! Quote Link to comment https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/#findComment-1429466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.