Jump to content

reading symbols from MySQL into php


ScrewLooseSalad

Recommended Posts

   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...

Link to comment
https://forums.phpfreaks.com/topic/277840-reading-symbols-from-mysql-into-php/
Share on other sites

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?

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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.