Wanye
Wanye

Reputation: 485

MySQL insert fails with '&' character

I am inserting a row in my database that contains text.

The record fails to insert if the '&' symbol is contained within.

The text is taken from a web page textarea and the web page charset is utf-8

My database schema is MyIsam and collation latin1_swedish_ci

The > and the < symbols also fail an insert

Can anyone advise?

Thanks in advance

Upvotes: 1

Views: 733

Answers (1)

Samy Dindane
Samy Dindane

Reputation: 18706

Escape them with mysql_real_escape_string() if you use mysql_ functions, or prepare your query with PDO.

Upvotes: 4

Related Questions