-2

How can I insert special characters like and é into a sql table? When I try it I get the error below:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '] ♣ us3rnamé', '123456789', 'http://blabla.com/blabla/', 'http://' at line 1

The data type is text. I guess that shouldn't matter.

Manticore
  • 1,284
  • 16
  • 38

2 Answers2

0

You probably need to tell the database you want to use a different character set. Try sending a query with SET NAMES 'utf8' right after you connect, and before you insert anything.

Steven V
  • 16,357
  • 3
  • 63
  • 76
0

Try addslashes in php documentation

Pruthvi Raj Nadimpalli
  • 1,335
  • 1
  • 15
  • 30