| | |
INSERT VALUES (HTML CODE) problems!
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Solved Threads: 0
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>');
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>');
Last edited by aaronknightkc; Mar 2nd, 2008 at 3:04 am.
Your insert query works fine on my computer. Check if you have the column names right. Also escape all the special characters using addslashes .
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Dec 2007
Posts: 195
Reputation:
Solved Threads: 27
Always use mysql_error() to debug mysql errors in when working with PHP.
Use addslashes() as nav33n suggested or use mysql_real_escape_string().
Use addslashes() as nav33n suggested or use mysql_real_escape_string().
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Solved Threads: 0
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.
![]() |
Similar Threads
- JSTL compare string (JSP)
- Warning: mysql_connect(): Access denied (PHP)
- Problems in inserting data into MySQL table from JSP.... (JSP)
- java.lang.NoClassDefFoundError: java/lang/StringBuilder (Java)
- Variable passed to each() is not an array (PHP)
- Trying to return query results (ColdFusion)
- This Should be Easy for You Guys! (Linux Servers and Apache)
- This ought to be simple - extra spaces (PHP)
- Problems with first php file (PHP)
Other Threads in the MySQL Forum
- Previous Thread: Help required with .sql file!
- Next Thread: SQL query program to edit records
| Thread Tools | Search this Thread |
Tag cloud for MySQL
1 agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns cmg communityjournalism contentmanagement contractors copyright count court data database design developer development distinct drupal dui ec2 email enter enterprise error eudora facebook form foss gnu government gpl greenit groklaw hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire law legal license licensing maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php query referencedesign reorderingcolumns resultset saas search select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency update virtualization






