Jump to content


Photo

reading symbols from MySQL into php

mysql php symbol character phpmyadmin

  • Please log in to reply
4 replies to this topic

#1 ScrewLooseSalad

ScrewLooseSalad

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 09 May 2013 - 09:38 AM

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



#2 gizmola

gizmola

    Advanced Member

  • Administrators
  • 4,126 posts
  • LocationLos Angeles, CA USA

Posted 09 May 2013 - 02:06 PM

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.

#3 ScrewLooseSalad

ScrewLooseSalad

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 10 May 2013 - 04:03 AM

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, 10 May 2013 - 04:05 AM.


#4 Irate

Irate

    Advanced Member

  • Members
  • PipPipPip
  • 358 posts
  • LocationHamburg, Germany
  • Age:17

Posted 10 May 2013 - 04:22 AM

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.
Quod placet mihi non placeat tibi. - What I think to be good must not always equal your perception of it.

I am not perfect. I try a lot with the code I provide and I don't guarantee for it to work as I have mostly no option to test it on my mobile phone. I do apologize for any inconvenience I caused, but if I do happen to have helped, liking my posts or marking them as to have solved or answered your question would be nice.

#5 ScrewLooseSalad

ScrewLooseSalad

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 10 May 2013 - 04:27 AM

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!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com