Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 mysql-a different error


raskolt

Recommended Posts

Here is the 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 'p left join specials s on p.products_id = s.products_id, products_to_categories ' at line 1

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from productsmp.people_id, mp.director, mp.actor frommovies_people p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

 

[TEP STOP]

 

I tried to find it. Is it because of the modules that I installed? Some categories do not give this error, especially the one that do not include much categories.

 

Do you have any idea why my store give this error?

Link to comment
Share on other sites

Here is the 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 'p left join specials s on p.products_id = s.products_id, products_to_categories ' at line 1

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from productsmp.people_id, mp.director, mp.actor frommovies_people p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

 

[TEP STOP]

 

I tried to find it. Is it because of the modules that I installed? Some categories do not give this error, especially the one that do not include much categories.

 

Do you have any idea why my store give this error?

 

 

If your server is running PHP 5 then you need to change the above statement to this :

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from (productsmp.people_id, mp.director, mp.actor frommovies_people p) left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

 

It's the way PHP 5 deals with join statements and you need the ( and ) round the table names:

 

from (productsmp.people_id, mp.director, mp.actor frommovies_people p) left join

 

HTH

Link to comment
Share on other sites

If your server is running PHP 5 then you need to change the above statement to this :

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from (productsmp.people_id, mp.director, mp.actor frommovies_people p) left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

 

It's the way PHP 5 deals with join statements and you need the ( and ) round the table names:

 

from (productsmp.people_id, mp.director, mp.actor frommovies_people p) left join

 

HTH

 

 

I have also just noticed this :

 

mp.actor frommovies_people p

 

Insert a space, since I assume the table is called movies_people not frommovies_people, in which case the code above probbaly doesn't need the extra '(' and ')' and needs to be :

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from productsmp.people_id, mp.director, mp.actor from movies_people p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

 

 

Edited: In fact, that query looks totally wierd - you have two "from" statements in there and I'm not exactly sure what you are trying to return from which tables, now that I've looked at it in more detail!

 

I'm not even sure if a query with two "from" statements will work, so will have to see if any other SQL guru's (since I certainly aren't one) can help on this one!

Link to comment
Share on other sites

I have also just noticed this :

 

mp.actor frommovies_people p

 

Insert a space, since I assume the table is called movies_people not frommovies_people, in which case the code above probbaly doesn't need the extra '(' and ')' and needs to be :

 

select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from productsmp.people_id, mp.director, mp.actor from movies_people p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '3' and p.products_status = '1' order by p.products_date_added desc limit 9

Edited: In fact, that query looks totally wierd - you have two "from" statements in there and I'm not exactly sure what you are trying to return from which tables, now that I've looked at it in more detail!

 

I'm not even sure if a query with two "from" statements will work, so will have to see if any other SQL guru's (since I certainly aren't one) can help on this one!

 

Thanks, with your recommendations, finally I have solved the problem. This error originated from the mistakes that I have made in products new.php file. I uploaded the old one and now it is ok.

 

I had not thought that it would originate from that file.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...