User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 373,375 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,715 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 659 | Replies: 6
Reply
Join Date: Mar 2008
Posts: 3
Reputation: aaronknightkc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
aaronknightkc aaronknightkc is offline Offline
Newbie Poster

INSERT VALUES (HTML CODE) problems!

  #1  
Mar 2nd, 2008
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>');
Last edited by aaronknightkc : Mar 2nd, 2008 at 2:04 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2006
Posts: 65
Reputation: silviuks is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 11
silviuks silviuks is offline Offline
Junior Poster in Training

Re: INSERT VALUES (HTML CODE) problems!

  #2  
Mar 2nd, 2008
can you show us your table structure and your php code?
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is online now Online
Posting Sensei

Re: INSERT VALUES (HTML CODE) problems!

  #3  
Mar 2nd, 2008
Your insert query works fine on my computer. Check if you have the column names right. Also escape all the special characters using addslashes .
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 102
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
mwasif mwasif is offline Offline
Junior Poster

Re: INSERT VALUES (HTML CODE) problems!

  #4  
Mar 2nd, 2008
Always use mysql_error() to debug mysql errors in when working with PHP.

Use addslashes() as nav33n suggested or use mysql_real_escape_string().
Reply With Quote  
Join Date: Mar 2008
Posts: 3
Reputation: aaronknightkc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
aaronknightkc aaronknightkc is offline Offline
Newbie Poster

Re: INSERT VALUES (HTML CODE) problems!

  #5  
Mar 2nd, 2008
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.
Reply With Quote  
Join Date: Dec 2007
Posts: 102
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
mwasif mwasif is offline Offline
Junior Poster

Re: INSERT VALUES (HTML CODE) problems!

  #6  
Mar 2nd, 2008
Can you post your table structure?
Reply With Quote  
Join Date: Mar 2008
Posts: 3
Reputation: aaronknightkc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
aaronknightkc aaronknightkc is offline Offline
Newbie Poster

Re: INSERT VALUES (HTML CODE) problems!

  #7  
Mar 2nd, 2008
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 3:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC