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

Link to comment
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?

Edited by ScrewLooseSalad
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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