PDA

View Full Version : sql syntax error


moonbeam
5-23-05, 01:54 PM
Hello all,
I have posted this error in other forums to no avail. This is my last resource, so I hope someone here can help. I have installed a contribution to edit information pages via my admin (contact us, conditions of use, shipping, etc...). When I try to view these pages in admin I get this error:
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 '?osCAdminID=28c0588e03ca8e80ac7964d9d01cff12' at line 1
I have no idea what to do about this. This would be a great feature to add to my store, I just can't get past this darn error. Any ideas? I have reviewed all the synax error posts in this forum, I do not think my error has to do with a negative number.?
Always greatful,
Moonbeam

stevel
5-23-05, 02:13 PM
Well, it seems that there is a URL being interpreted as PHP syntax. Does the message identify a file containing the error? (It usually does.) I'm having trouble imagining what sort of syntax error would cause this particular symptom.

moonbeam
5-23-05, 02:21 PM
Steve,
Glad to see you! The error message is just how I have posted. However the osCadminID changes as to what page I click to.
Information for Conditions of Use

Select English
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 '?osCAdminID=aed5cfe3852f0925344829824ce33cef' at line 1

Information for Shipping and Returns

Select English OR French
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 '?osCAdminID=a2014d8127b77688fd8d8b4c1f40e65b' at line 1

Information for Privacy Policy

Select English OR French
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 '?osCAdminID=5c1c35498e6ea477c5a0859a2dbbbb42' at line 1

These are the three errors...

stevel
5-23-05, 06:03 PM
Send me a PM with ftp login info for your site and I'll take a look.

stevel
5-23-05, 09:25 PM
The contribution you are using has a serious bug in it. I can't believe they released it this way.

In the four "information box" files (privacy, shipping, etc.), there's code similar to this:
if ($info_lang == 1) {
echo '<a href="' . tep_href_link('privacy.php?info_lang=1', '', 'NONSSL') . '"><font color=blue><b>English</b></font></a>';
echo ' OR </font>';
echo '<a href="' . tep_href_link('privacy.php?info_lang=4', '', 'NONSSL') . '"><font color=blue>French</font></a><br>';
}
if ($info_lang == 4) {
echo '<a href="' . tep_href_link('privacy.php?info_lang=1', '', 'NONSSL') . '"><font color=blue>English</font></a>';
echo ' OR </font>';
echo '<a href="' . tep_href_link('privacy.php?info_lang=4', '', 'NONSSL') . '"><font color=blue><b>French</b></font></a><br>';
}
The calls to tep_href_link are incorrect. Instead of, for example:
tep_href_link('privacy.php?info_lang=4', '', 'NONSSL') it should read: tep_href_link('privacy.php', 'info_lang=4', 'NONSSL')
Note that the part of the first argument after the ? moves to the second argument, and the ? goes away. With tep_href_link, any "parameters" for the page go in the second argument. I fixed the four of these for shipping, you can do the rest.

The problem this caused was that the URL for the pages had two question marks in them, which confused the code that tried to identify the language ID.

I also corrected your definition of HTTP_SERVER for the admin section - it had an extra slash and the wrong hostname.

moonbeam
5-23-05, 11:30 PM
Wow, I am truley amazed...
Their is no way in hell I could have figured that out.
Thank you so much Steve for showing me the way.

By the way, I love your vacation pictures. I hope someday I too can travel to those beautiful places.
Thanks again
Always greatful,
Moon

stevel
5-24-05, 10:26 AM
I need to retract the "I can't believe they released it this way", as once upon a time I made the same mistake in a contribution I released, though the symptom was not as obvious as here. Of course, I fixed it as soon as I realized what I had done...

moonbeam
5-24-05, 08:35 PM
I have made all the changes Stevel suggested, it works perfect now!
Thanks again,
Moonbeam