0

If i enter a £ (UK Pound Symbol) into my DB why does it always add to the database with as £.

I thought this was down to the charset but thought utf8 should cure this

EDIT i am setting the charset as below

$db = new PDO('mysql:host='.DBHOST.';dbname='.DBNAME.';charset=utf8', DBUSER, DBPASS);

any advice please.

Ford
  • 537
  • 6
  • 20

1 Answers1

0

Use this before any other query

SET NAMES utf8;
Mihai
  • 26,325
  • 7
  • 66
  • 81
  • $db->exec('SET NAMES utf8;') – Mihai Nov 09 '13 at 01:31
  • Why has this been marked down? it WORKS perfectly! i have tried stackoverflow.com/a/279279/1679849 but am already doing everything it suggests (i think) but adding $db->exec('SET NAMES utf8;') to the INSERT query seems to have fixed the issue! – Ford Nov 09 '13 at 01:37