-1

I am inserting submitted data into a table.

Here is the echoed SQL Query:

INSERT INTO adhocbills_lineitems (bill_seq, unitprice, quantity, sagenominalcode, description) values ('119', '10', '1', '4000', 'test product for £ pounds')

but when i look in the database, it says test product for £ pounds

how can i get rid of the  character when inserting?

charlie
  • 1,356
  • 7
  • 38
  • 76

2 Answers2

0

In this case you must check the Collation. You can use latin1-bin. To match php encoding you can use :

header('Content-Type: text/html; charset=latin1-bin');
Hamed Kamrava
  • 12,359
  • 34
  • 87
  • 125
0

Better to use utf-8 to support any character. You may fix this for latin1, but at some point you will have problem with other characters. Change your table collation to utf8. And make sure your php file has:

<meta charset="utf-8">

and

header('Content-Type: text/html; charset=utf-8');
Aris
  • 4,643
  • 1
  • 41
  • 38