Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 06-11-2004, 12:44 PM   #1 (permalink)
Professor of Drinkology
 
[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:
index_number AUTO_INCREMENT
content TEXT
update_date TIMESTAMP
Here's my script:
Quote:
#select table
use brenthoard;

# insert Experience page into Database
INSERT INTO pages VALUES
(
1, "<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=430,height=490,left = 20,top = 20');");
}
// End -->
</script>

<!--backing images off the navbar-->
<table width="653" border="0" cellspacing="12" cellpadding="12">
<tr>
<td width="93" align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=twd.wmv&title=TWD&videob=twd_large.wmv')"><img src="images/twd.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=twd.wmv&title=TWD&videob=twd_large.wmv')">Guided Tour </a></p></td>
<td width="476" align="left" valign="top"> <a href="http://www.twd3.com">http://www.twd3.com</a>: I began working for Third Wave Digital in May of 2003 and have since become the resident search engine placement (SEP) expert. It has become my goal to optimize each page that is created or maintained by Third Wave Digital for placement in the major search engines (Yahoo.com, Google.com, Altavista.com, etc.) with the expectation of high listings for targeted keywords (within the top 30 of total results). </td>
</tr>
<tr>
<td align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=swsphoto.wmv&title=SchroederPhotography&videob=swsphoto_large.wmv')"><img src="images/swsphoto.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=swsphoto.wmv&title=SchroederPhotography&videob=swsphoto_large.wmv')">Guided Tour </a></p></td>
<td align="left" valign="top"> <a href="http://www.swsphoto.com">http://www.swsphoto.com</a>: For over 10-years, Steve Schroeder has been taking Macon 's portraits and has been quite successful in operating his own studio, Schroeder Photography Studios, without any major form of advertising. In May of 2003, Steve came to a business decision to begin a marketing campaign to boost his business and contacted Third Wave Digital about producing a website for his company. I worked independently on this project for Third Wave Digital as the lead designer and developer. </td>
</tr>
<tr>
<td align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=voc.wmv&title=VOC&videob=voc_large.wmv')"><img src="images/voc.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=voc.wmv&title=VOC&videob=voc_large.wmv')">Guided Tour </a></p></td>
<td align="left" valign="top"><a href="http://www.vidaliaonion.org">http://www.vidaliaonion.org</a>: The Vidalia Onion Committee (VOC) contacted Third Wave Digital in April of 2003 seeking assistance with building their own web presence. Over the course of 3 months, the teams of graphic artists and web programmers at Third Wave Digital developed a multimedia platform for the Committee that launched in mid-June. As a member of the VOC team, I worked enthusiastically on the artistic development and the coding aspects of this project. </td>
</tr>
<tr>
<td align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=tcemc.wmv&title=TriCountyEMC&videob=tcemc_large.wmv')"><img src="images/tcemc.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=tcemc.wmv&title=TriCountyEMC&videob=tcemc_large.wmv')">Guided Tour </a></p></td>
<td align="left" valign="top"> <a href="http://www.tricountyemc.com">http://www.tricountyemc.com</a>: TriCounty EMC provides electricity for a large portion of rural-Macon, Georgia 's community. As a large utility, TriCounty needed a webservice to provide information not only to its customers, but also to its personnel. The resulting website developed at Third Wave Digital is coded heavily in Cold Fusion with features that enabled the client, TriCounty EMC, to handle all maintenance. </td>
</tr>
<tr>
<td align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=hydroblast.wmv&title=IndustrialHydroblast&videob=hydroblast_large.wmv')"><img src="images/hydroblast.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=hydroblast.wmv&title=IndustrialHydroblast&videob=hydroblast_large.wmv')">Guided Tour </a></p></td>
<td align="left" valign="top"> <a href="http://www.industrialhydroblast.com">http://www.industrialhydroblast.com</a>: Industrial Hydroblast was one of my first projects for Third Wave Digital. The Industrial Hydroblst website was nearly complete when I joined the TWD team, but I have been steadily working since the site's official launch in May of 2003 to ensure high search engine placement results. As one of the sites under my SEP care, Industrial Hydroblast has produced exciting results on Altavista and MSN, even though its content limitations have made it an extremely difficult site to place. </td>
</tr>
<tr>
<td align="center" valign="top"><p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=seo.wmv&title=SEO&videob=seo_large.wmv')"><img src="images/seo_thumb.jpg" width="79" height="79" border="0"></a></p>
<p><a href="javascript:popUp('http://www.brenthoard.com/brenthoard.com-asp/video.asp?video=seo.wmv&title=SEO&videob=seo_large.wmv')">Guided Tour </a></p></td>
<td align="left" valign="top">- http://www.1842inn.com/ <br />
- http://www.access-env.com/ (11/03 - Access-Env.com is officially closed) <br />
- http://www.basscustomlandscapes.com/ <br />
- http://www.covenantcareadoptions.com/ <br />
- http://www.dreisner.com/ <br />
- http://www.industrialhydroblast.com/ <br />
- http://www.leschwartz.com/ <br />
- http://www.maconmagazine.com/ <br />
- http://www.maconworks.com/ <br />
- http://www.museumofaviation.org/ <br />
- http://www.pilotinternational.org/ <br />
- http://www.schwartzprecision.com/ <br />
- http://www.spwkits.com/ <br />
- http://www.superlawntrucks.com/ <br />
- http://www.ohtrail.com</td>
</tr>
</table>");

# show all data pertaining to this page
SELECT * FROM pages;
Here's the error I receive:
Quote:
mysql> source experience.sql;
Database changed
ERROR 1064: You have an error in your SQL syntax near 'JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.get' at line 3
ERROR 1064: You have an error in your SQL syntax near '}
// End -->
</script>

<!--backing images off the navbar-->
<table width=' at line 1
[/quote]
__________________
Blah.

Last edited by tritium; 06-11-2004 at 12:53 PM..
tritium is offline  
Old 06-11-2004, 12:56 PM   #2 (permalink)
Crazy
 
Location: Salt Town, UT
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
Rawb is offline  
Old 06-11-2004, 01:15 PM   #3 (permalink)
Professor of Drinkology
 
I went through and changed all the single quotation marks to the \" and received a series of errors:

Quote:
ERROR:
Unknown command '\"'.
I went back and changed all the \ to / and received the original error message again.
__________________
Blah.
tritium is offline  
Old 06-11-2004, 07:34 PM   #4 (permalink)
Junkie
 
Location: RI
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.
Fallon is offline  
Old 06-11-2004, 09:12 PM   #5 (permalink)
Banned
 
cthulu23's Avatar
 
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>");




Last edited by cthulu23; 06-11-2004 at 09:24 PM..
cthulu23 is offline  
Old 06-13-2004, 09:50 PM   #6 (permalink)
Professor of Drinkology
 
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.
__________________
Blah.
tritium is offline  
Old 06-13-2004, 10:54 PM   #7 (permalink)
Rookie
 
cliche's Avatar
 
Location: Oxford, UK
Quote:
I'll need to figure out why the /" thing doesn't work correctly.
Careful - there's a difference between '/' (forward slash) and '\\' (backslash). Use the backslash to escape the quotes.
__________________
I can't understand why people are frightened of new ideas. I'm frightened of the old ones. -- John Cage (1912 - 1992)

Last edited by cliche; 06-14-2004 at 07:36 AM..
cliche is offline  
 

Tags
failing, file, mysql, script


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 07:37 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360