I am trying to run this MySQL query---

UPDATEsldruw_oldschoolapps2.jos_contentSETintrotext= replace(introtext, ’><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>’, ' target="_blank" onclick="window.open('http://trkur.com/trk?o=11326&p=68773');"><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>’);

and keep getting the following error---

#1064 - 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 '><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>’, ' at line 1

I can't seem to find the reason for this syntax error. Please help!

Recommended Answers

All 5 Replies

I replaced all " with ' and received this error---

Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 84
STR: ><
SQL: UPDATE sldruw_oldschoolapps2.jos_content SET introtext = replace introtext, ’><img src='http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png' /></a>’, ' target='_blank' onclick='window.open('http://trkur.com/trk?o=11326&p=68773');UPDATE sldruw_oldschoolapps2.jos_content SET introtext = replace introtext, ’><img src='http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png' /></a>’, ' target='_blank' onclick='window.open('http://trkur.com/trk?o=11326&p=68773');UPDATE sldruw_oldschoolapps2.jos_content SET introtext = replace introtext, ’><img src='http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png' /></a>’, ' target='_blank' onclick='window.open('http://trkur.com/trk?o=11326&p=68773');

SQL query:

UPDATE sldruw_oldschoolapps2.jos_content SET introtext = replace introtext, ’><img src='http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png' /></a>’, ' target='_blank' onclick='window.open('http://trkur.com/trk?o=11326&p=68773');

MySQL said: Documentation

1064 - 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 'introtext, ’><img src='http://www.oldschoolapps.com/files/img/OSA_Rating-DL.pn' at line 1

I meant this:

UPDATE sldruw_oldschoolapps2.jos_content
SET introtext = replace(introtext, '><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>', ' target="_blank" onclick="window.open(\'http://trkur.com/trk?o=11326&p=68773\');"><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>');

This quote is causing your issue, not the double quotes.

That worked great! Thank you.

However, now I am running another query using that same syntax that just worked but with different content being replaced, and I am once again getting syntax errors---

UPDATE sldruw_oldschoolapps2.jos_content SET introtext = replace(introtext, ‘><img src="files/img/OSA_Rating-DL.png" alt="download abandonware games"/></a>', ' target="_blank" onclick="window.open(\'http://trkur.com/trk?o=11326&p=68773\');"><img src="http://www.oldschoolapps.com/files/img/OSA_Rating-DL.png" /></a>');

Nevermind that last error. I replaced the quote after "introtext, " and it worked. Thanks again!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.