![]() |
[mySQL] Script file failing HELP!
I'm trying to use a script file to insert information into a table called, pages, belonging to the database, brenthoard. This is probably something n00bish ...
Here are the table fields: Quote:
Quote:
Quote:
|
Watch your quoting
Watch your quotes. You need to put anything text-wise into a database enclosed in quotes. But when it hits another set of those quotes, the quoting stops, and it tries to go back into plain old sql mode.
So everywhere in your actual text, you need to escape all of the " with \" (most systems have a way to do this, like php's addslashes() ) Example: Before: INSERT INTO pages VALUES ( 1, "<SCRIPT LANGUAGE="JavaScript"> <!-- Begin After: INSERT INTO pages VALUES ( 1, "<SCRIPT LANGUAGE=\"JavaScript\"> <!-- Begin |
I went through and changed all the single quotation marks to the \" and received a series of errors:
Quote:
|
Wanna post your updated script? I spent about 10 minutes going thru it(should have used a text editor and done search/replace) and gave up when I looked and I wasn't even halfway.
|
One possible quick fix...replace all double quotes in the code itself with single quotes and then wrap the code in double quotes. You have an awful lot of special characters in your javascript/html, so you have to be careful to segregate SQL significant characters from your code.
Edit: the suggestion to escape any double quotes with a "\" (ie - \") should work, but only if you leave the outermost, wrapping quotes alone...for instance: "<SCRIPT LANGUAGE=\"JavaScript\">...</table>"); |
I'll post a link to the script tomorow. I wound up using ' instead of " ... this allowed me to input the text to the database, but trashed my javascripting...
I'll need to figure out why the /" thing doesn't work correctly. |
Quote:
|
All times are GMT -8. The time now is 02:33 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project