473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Use of ; and " in a text block.

5
I've had a good run of help on this site when I get to an issue I struggle to think through.

I have set-up a database through ASP that allows the site's owner to login into an Admin section and using a WYSIWYG editor dynamically change content on the site. The Editor I am using is TinyMCE.

Where I have an issue is, when the editor uses ' or " within their text blob, I get a MySQL error...
Microsoft OLE DB Provider for ODBC Drivers
error '80004005'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-max-log]SQLBindParameter not used for all parameters
admin/message.asp, line 66
Which I assume is because the first time an apostrophe or quotes is used, MySQL feels that is the end of the statement, and doesn't understand how to handle the rest of the content spewed from the WYSIWYG editor.

My ASP coding to handle the updated text blob is, teh variable Content being the WYSIWYG output, and MessageName, is the section of the site they are editing...
Expand|Select|Wrap|Line Numbers
  1. query="UPDATE message SET Content='"&Content&"' WHERE MessageName='"&Message&"'"
  2. set(upd)=oConn.execute(query)
  3.  
Any help would be much appreciated. Thank You.
Jan 19 '09 #1
4 2143
Atli
5,058 Expert 4TB
Hi.

You are probably right. By creating the query like that any quote-marks would cause syntax problems.
You would need to escape the quotes before you insert them into the query.

Not sure how you would go about doing that in ASP.
I'll move this question over to the ASP forum. I'm sure the experts there will know.
Jan 19 '09 #2
bwrobo
5
OK... researched this one out and found the solution....

The reason for the problem is that the use of ' and " within the string confuses MySQL into thinking the string has ended. The solution is to replace both " and ' with the HTML codes ´ and "

You will get an error if you try to enter in the function
Content=replace(Content,""",""")
To fix this, use the " chr equivialent of chr(34).

So the solution to the problem is....
Content=replace(Content,"'","´")
Content=replace(Content,chr(34),""")
Jan 20 '09 #3
Atli
5,058 Expert 4TB
Glad you found a solution.
Thanks for sharing it.

Although, ideally, you wouldn't want to put characters specific to your front-end (in your case, HTML) into the database. You would want it to be like the original data.

In PHP, we would escape characters like quotes, so a query would look like:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl VALUE( 'Somebody\'s name');
The \' would be interpreted as a part of the string, and once inserted, would lose the \ and become just the single-quote.

If I am not mistaken (and please, correct me if I'm wrong here), ASP does this by doubling the quotes, like:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl VALUE( 'Somebody''s name');
Note that those are two single-quotes, not a double-quote.

Perhaps it doesn't really make much of a difference in this case, but it's worth considering.
Jan 20 '09 #4
bwrobo
5
You are correct, ASP handles escapes characters as double quotes, however, in this case as my web user is updating information that will be directly displayed on the output website, it was simple to just use HTML Characters.
Jan 20 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
40
by: Greg G | last post by:
http://risky-biz.com/new/risky.html I finally got DSL service recently, but I haven't forgotten the agony of waiting for the 64th image to load before I can see ANYTHING on a page. So I will...
2
by: Markus Dehmann | last post by:
I'd like to process text or document templates that use "embedded C++". Here is a constructed example (the texts I have in mind are much longer and contain relatively few code blocks): ...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
8
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
15
by: pbd22 | last post by:
Hi. I want to create a tab with a little "active tab" arrow below it to tell the user where they are. An example is here: http://personals.yahoo.com/us/search/dashboard Does anybody know of...
3
by: bhavyagupt | last post by:
i 'm not able to use the accordion menu code in for loop . can anyone solve ma problem. code....... slider.js------> java script var slider=function(){ var array=; var speed=10; var...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
2
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.