rajaboys Posted March 15, 2010 Share Posted March 15, 2010 Hi, there is a form with three field like news title, description, user can post heading with description(with special char), for this i have created table name called news with the following data type varchar for heading, longtext for description, this is my input " heading: - good morning to all description: - "Dear All, Greetings from ECD!! A small article on “Nobody’s friend” My name is Gossip. I have no respect for justice. I break hearts and ruin lives. I am cunning, malicious and gather strength with age. The more I am quoted, the more I am believed. I flourish at every level of society. My victims are helpless. They cannot protect themselves against me because I have no name and no face. To track me down is impossible. The harder you try, the more elusive I become. I am nobody's friend. Once I tarnish a reputation, it is never the same. I topple governments and wreck marriages. I ruin careers and cause sleepless nights, heartaches and indigestion. I spawn suspicion and generate grief. I make innocent people cry in their pillows. Even my name hisses. I am called GOSSIP. Office gossip Shop gossip Party gossip Telephone gossip I make headlines and headaches. REMEMBER, when you repeat a story, ask yourself: Is it true? Is it fair? Is it necessary?? If not, do not repeat it. Have a great day!! Thanks & Regards " im getting this error 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 's friend. Once I tarnish a reputation, it is never the same. ' at line 2 Quote Link to comment https://forums.phpfreaks.com/topic/195292-phpmysql-doesnt-save-special-char/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 15, 2010 Share Posted March 15, 2010 All non-numeric data put into a query must be escaped so that any special SQL characters in it don't break the SQL syntax of the query. See this link - mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/195292-phpmysql-doesnt-save-special-char/#findComment-1026268 Share on other sites More sharing options...
rajaboys Posted March 15, 2010 Author Share Posted March 15, 2010 hi,, i was used real escape string insert successfully but while showing it show like this Surat has conducted a three days workshop <!-- /* Font Definitions */ @font-face {font-family:\"Cambria Math\"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:\"Century Schoolbook\"; panose-1:2 4 6 4 5 5 5 2 3 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:647 0 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:\"\"; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:\"Times New Roman\",\"serif\"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> \r\n Dear All, \r\n \r\n Greetings from ECD!! \r\n \r\n A small article on “Nobody’s friend” \r\n \r\n My name is Gossip. I have no respect for justice. I break hearts and ruin lives. I am cunning, malicious and gather strength with age. The more I am quoted, the more I am believed. I flourish at every level of society. My victims are helpless. They cannot protect themselves against me because I have no name and no face. To track me down is impossible. The harder you try, the more elusive I become. I am nobody\'s friend. Once I tarnish a reputation, it is never the same. I topple governments and wreck marriages. I ruin careers and cause sleepless nights, heartaches and indigestion. I spawn suspicion and generate grief. I make innocent people cry in their pillows. Even my name hisses. I am called GOSSIP. Office gossip Shop gossip Party gossip Telephone gossip I make headlines and headaches. REMEMBER, when you repeat a story, ask yourself: Is it true? Is it fair? Is it necessary?? If not, do not repeat it. \r\n \r\n Have a great day!! \r\n \r\n Thanks & Regards \r\n \r\n \r\n \r\n Chennai. \r\n \r\n \r\n Quote Link to comment https://forums.phpfreaks.com/topic/195292-phpmysql-doesnt-save-special-char/#findComment-1026270 Share on other sites More sharing options...
PFMaBiSmAd Posted March 15, 2010 Share Posted March 15, 2010 Umm. You would need to tell us what is wrong with that output vs what you expect and post the code responsible for retrieving and displaying the output if you want someone to help with what it is doing. Quote Link to comment https://forums.phpfreaks.com/topic/195292-phpmysql-doesnt-save-special-char/#findComment-1026272 Share on other sites More sharing options...
rajaboys Posted March 15, 2010 Author Share Posted March 15, 2010 hi,, it displays with font style everything in page. i want to show what user select color, font family for text, it should not show like this in code <!-- /* Font Definitions */ @font-face {font-family:\"Cambria Math\"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:\"Century Schoolbook\"; panose-1:2 4 6 4 5 5 5 2 3 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:647 0 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:\"\"; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:\"Times New Roman\",\"serif\"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> Quote Link to comment https://forums.phpfreaks.com/topic/195292-phpmysql-doesnt-save-special-char/#findComment-1026274 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.