I am trying to insert a row into a table into a MySQL DB 5.0 table. One of the VALUES that I am inserting just so happens to be HTML code. When I execute the INSERT in MySQL Query Browser it tells me "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 "<p> This section will display the current status of the client including the con' at line 1". It is ErrorNr. 1064. Below is the INSERT statement. The text in the above error is the start of the third column in the VALUES statement.

EXAMPLE CODE
======================================
INSERT INTO `HelpTopics` (`topicID`, `topicName`, `topicContent`) VALUES (100,'Manage Client','<p>This section will display the current status of the client including the contact name, \r\n employee name, date client account was created, and whether the account is private or \r\n public. Under the Client Documents section, you will be able to quickly view categories \r\n and documents stored for this client. Document information easily viewed includes the type of file, tax year of the document, a file description or name, file size, and the date created. </p>\r\n <p>Additional features of this section are listed below. </p>\r\n <p><strong>To Edit a client:</strong> \r\n Select the <img src=\"images/edit.gif\" width=\"20\" height=\"20\" > \r\n icon above the client information after the Company Name.</p>\r\n <p><strong>To Add a sub category:</strong> \r\n Select the <img src=\"images/add.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired category. </p>\r\n <p><strong>To Add a document:</strong> \r\n Select the <img src=\"images/addDoc.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired category.</p>\r\n <p><strong>To Select a document:</strong> Open a category section by selecting the (+) icon of a category and click hyperlink description of a document.</p>\r\n <p><strong>To Edit a document:</strong> \r\n Select the <img src=\"images/edit.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired document.</p>\r\n <p><strong>To Delete a document:</strong> \r\n (Administrators Only) Select the <img src=\"images/delete.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired document.</p>\r\n <p><strong>To Edit a category:</strong> \r\n Select the <img src=\"images/edit.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired category.</p>\r\n <p><strong>To Delete a category:</strong> \r\n (Administrators Only) Select the <img src=\"images/delete.gif\" width=\"20\" height=\"20\" > \r\n icon on the right hand side of the screen in line with the desired category.</p>\r\n <h3>Additional Notes :</h3>\r\n <ul>\r\n <li>Master Categories feature an expand (+) or a hide (-) icon to either view other categories \r\n listed under a category or hide categories for easy viewing.</li>\r\n <li>Categories will also feature a number in parenthesis after the category name to indicate the \r\n number of documents currently stored by that user in the category. </li>\r\n <li>A category may not be deleted unless documents are deleted from that category. </li>\r\n </ul>');

can you show us your table structure and your php code?

Your insert query works fine on my computer. Check if you have the column names right. Also escape all the special characters using addslashes .

I am not inserting these values from PHP. I have just set up an SQL database and I am populating the tables with some values that need to be there before I set up tomcat and my eclipse workspace to start working on an app.

Can you post your table structure?

Actaully just figured out the issue. When this data was dumped into its file there were some tab characters that worked there way in there. Crazy... Thanks for all the help. This is the first time I have used a forum like this. I got all these responses in the first 24 hours. Thanks againn for all the help. I will be on this forum a lot from now on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.