close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Syntax Error - Adding Product Details

Thread began 1/15/2012 11:14 am by greg_herr420504 | Last modified 1/18/2012 11:00 am by Jason Byrnes | 1512 views | 5 replies |

greg_herr420504

Syntax Error - Adding Product Details

Hello,
I'm trying to add simple product options to my ecart. Just to get it to work I set my database up as exampled in the thread showthread.php?t=21546&highlight=product+options. I then followed the 'Product Options with eCart' tutorial. I think I'm close, but get the following syntax 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 'WHEREÂ optiongroups.OptionGroupName = 'color' AND productoptions.ProductID = ' at line 1"

One thing I noticed in the tutorial when setting up the variables in the added record sets I was unable to select 'Integer'. I just have 'Numeric', 'Text', 'Date' and 'Double' in the drop down. I set all to Numeric, but notice the database has type set to 'Int'.

Could this be my trouble? If I can send any pages or info from the database please let me know what would help. Appreciate the help very much!

Greg

Sign in to reply to this post

Ray BorduinWebAssist

Numeric was the correct choice.

It looks like you have a strange character in your code: WHEREÂ

That should probably just be: WHERE

Try to find and correct that reference in your code. If that doesn't work, include a copy of your file in your next reply and we can take a look and try to see what might be causing the problem.

Sign in to reply to this post
Did this help? Tips are appreciated...

greg_herr420504

Reply

Ok - Noticed at 126 and 136 my WHERE had two spaces rather than one, like the others, so I made them one space, but now getting -> Unknown column '1' in 'where clause'

I've attached the products_Detail.php page and exported my sql database. Attached in a compressed folder called files.

Thanks for the help and the great service as always!

Greg

Attached Files
files.zip
Sign in to reply to this post

Ray BorduinWebAssist

I don't see where the problem is, but I can try to help you narrow it down.

There are 4 recordsets on your page... this error is coming from when one of those queries is running on one of the lines that ends in:

or die(mysql_error());

die(); will stop the code processing at that point and write whatever string is passed to it. In this case it is writing the error string.

What you can do, is add code before each line that has that code like:

echo("Recordset 1 ");

and write before the second time the die() appears:

echo("Recordset 2 ");

and do the same for the third and fourth.

Then when you view the page again it will look something like:

Recordset 1 Recordset 2 Recordset 3 Unknown column '1' in where clause

This would narrow down that the error was in the third recordset.

Then you could remove all of your echo statements since you have narrowed it down and in place of the last echo statement you saw, add a die statement with the sql... so if it was recordset 3 you would replace it with:

die($query_rsSize);

This would write the full sql statement to the page that is being run. That should allow you to see what might be the problem with that sql statement and fix it.

If you get that far and can't spot the issue, try taking that sql statement into phpMyadmin and debug it in the Query window there... you can also post it back here and I might be able to spot the problem.

Sign in to reply to this post
Did this help? Tips are appreciated...

greg_herr420504

Fixed! But maybe found something that would prevent for others.

Good Evening Ray,

Ok, I followed all of your instructions and found that it was the 4th recordset. Removed the 'echo' and added the die($query_rsSizeLookup). The result did have that funky character in it so I cut and pasted in the database query, removed that character and it worked. Looked back in the source code to where that character was showing up and there was an extra space before the last AND statement. Looked back at the tutorial I cut and pasted the code from and the extra space is there also. See attached for my work flow in fixing and maybe killing that extra space in the tutorial will prevent it from happening with other and save you guys some future time. Anyway, thanks a bunch... I think you just taught me how to fish a bit rather then just hitting me with a red snapper. : )

Greg

Attached Files
rsSizeLookup.docx.zip
Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear you have it working.

I dont see the  character when viewing the page you sent in your initial reply, the extra space in the recordset code should not make a difference, and I am not able to reproduce it, but i will forward this to our documentation team. Thanks for posting your results back.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...