Syntax error... help!

Posts: 7
Joined: 01/28/2008

hello...

I've been building a photo catalog and learning how Ubercart works along the way. I wanted to see more products on one page so I increased the number of products per page, I increased it to the number of products I had in the database not realizing it had to be a multiple of 3 because that is how many there are in a row. After I did this I began getting the error message below:

user warning: 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 'SELECT SUM(op.qty) FROM uc_order_products AS op query: SELECT nd.nid, nd.title, (SELECT SUM(op.qty) FROM uc_order_products AS op WHERE op.nid = nd.nid) AS sold FROM node AS nd WHERE nd.type IN ("product","photos") ORDER BY sold DESC LIMIT 3 in /homepages/21/d195465313/htdocs/rob/includes/database.mysql.inc on line 172.

I tried moving it back to 12 products per page but the error remained, I also tried making it 33 but got the same result. This error comes up on every page, even Drupal admin pages. I've searched to see if I can find an answer to this but none of the error messages I see are close to this one. I am completely at a loss, any ideas?

Any suggestions are welcome, thanks in advance for your help.
Don

Posts: 2102
Joined: 08/07/2007
AdministratoreLiTe!

What version of MySQL are you using? It probably doesn't like the sub-query syntax that's being used.

Try disabling modules, one by one, until the error message goes away. I'd start with the contrib modules because I can't find that query in any code on my test site.

Posts: 46
Joined: 11/22/2007

Seems to me like there are 2 sql statements messed up! the select sum() one is in the middle of the other...
You could use the drupal devel module and set it to "traceback" to ease your search of the error.

Posts: 7
Joined: 01/28/2008

The version of MySQL is 4.0, I've turned off every module that isn't either part of Ubercart or is listed as a requirement but I'm still seeing the same error. So for now besides the core modules and Ubercart this is what is running:

CCK - base install, nothing additional added on
Tables API
Imagecache
Thickbox
Token
uBrowser
Workflow-ng

Administration Menu is also running but it was installed after the error started.

I've run out of time to try and test the Ubercart modules, I'll try that later on tonight.

Posts: 1
Joined: 02/06/2008

I just got the same error when I changed the number of product nodes per page

Can anyone help??

Posts: 7
Joined: 01/28/2008

Ok, I've tried turning off modules until the error went away. The only time it went away was when I turned off Catalog, which I guess makes sense. You can't have a grid display of items without catalog.

Still baffled.

Posts: 887
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Lyle wrote:
What version of MySQL are you using? It probably doesn't like the sub-query syntax that's being used.

Try disabling modules, one by one, until the error message goes away. I'd start with the contrib modules because I can't find that query in any code on my test site.

That query is right out of the theme_uc_catalog_bestsellers_products() function in uc_catalog.module. You could turn off the bestsellers block from the catalog admin page to make it go away...

FWIW, it works fine for me, on MySQL 5.0.45. It is a syntactically valid SQL statement.

--

<tr>.

Posts: 7
Joined: 01/28/2008

TR thanks much, turning off the bestsellers block does indeed make the error go away. I had left it on to see what it would do, wasn't even sure it would make it to the final version of the store.

Posts: 2102
Joined: 08/07/2007
AdministratoreLiTe!

I checked the MySQL documentation, and subqueries weren't supported until 4.1. If it weren't for the fact that upgrading databases is a dangerous and scary process, I'd say get version 5 or 6. Then again, it'll have to be done eventually for Drupal 7.