Author Topic: 500 SQL Error  (Read 12416 times)

Justindew

  • Beginner
  • *
  • Posts: 16
500 SQL Error
« on: February 02, 2009, 20:44:10 pm »
This is my first post on this site so I should start off by saying I love Virtuemart have to say it is a great system. The developers are top notch cant imagine doing so much work then making it open source.

Now to the problem I am faced with most likely a mistake I made somewhere. My website was running fine up until last week. I had been adding several hundred products a day. Well everything seemed to be going fine. Until we went live upon going live everything slowed to a crawl. I assumed it was my server but upon further investigation after enabling debug in Joomla. I was faced with this error.

500 - JDatabaseMySQL::query: 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 'ORDER BY parameter_list_order' at line 1 SQL=SELECT * FROM jos_vm_product_type_parameter WHERE product_type_id= ORDER BY parameter_list_order

If anyone could help me I would be willing to compensate you for your time. This site was suppose to be up a month ago but I keep running into little problems like this.

SOMEONE PLEASE HELP!

nsw

  • Beginner
  • *
  • Posts: 46
    • Management Consultant
Re: 500 SQL Error
« Reply #1 on: July 31, 2009, 08:58:35 am »
I have a similar problem now on 2 sites, since upgrading VM as shown here:

http://forum.joomla.org/viewtopic.php?f=470&t=425695&p=1791234#p1791234
Can anybody advise a fix for this please ?

nsw

  • Beginner
  • *
  • Posts: 46
    • Management Consultant
Re: 500 SQL Error
« Reply #2 on: July 31, 2009, 09:01:20 am »
just found this http://forum.joomla.org/viewtopic.php?f=428&p=1785738
Might be a possible fix

nsw

  • Beginner
  • *
  • Posts: 46
    • Management Consultant
Re: 500 SQL Error
« Reply #3 on: July 31, 2009, 13:25:43 pm »
That did not fix it, here is the full error message;

500 - JDatabaseMySQL::query: 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 '' at line 1 SQL=SELECT category_name FROM jos_vm_category WHERE category_id =

•You may not be able to visit this page because of:•

   1. •an out-of-date bookmark/favourite•
   2. •a search engine that has an out-of-date listing for this site•
   3. •a mistyped address•
   4. •you have no access to this page•
   5. •The requested resource was not found.•
   6. •An error has occurred while processing your request.•

•Please try one of the following pages:•

    * •Home Page•

•If difficulties persist, please contact the System Administrator of this site.•

JDatabaseMySQL::query: 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 '' at line 1 SQL=SELECT category_name FROM jos_vm_category WHERE category_id =

Call stack
#    Function    Location
1    JSite->render()    /home/xxxxx/public_html/xxxxx/index.php:79
2    JDocumentHTML->render()    /home/xxxxx/public_html/xxxxx/includes/application.php:168
3    JDocumentHTML->_loadTemplate()    /home/xxxxx/public_html/xxxxx/libraries/joomla/document/html/html.php:246
4    require_once()    /home/xxxxx/public_html/xxxxx/libraries/joomla/document/html/html.php:338
5    ps_product_category->get_name_by_catid()    /home/xxxxx/public_html/xxxxx/templates/qtable/index.php:27
6    ps_DB->query()    /home/xxxxx/public_html/xxxxx/administrator/components/com_virtuemart/classes/ps_product_category.php:1159
7    JDatabaseMySQL->loadObjectList()    /home/xxxxx/public_html/xxxxx/administrator/components/com_virtuemart/classes/ps_database.php:120
8    JDatabaseMySQL->query()    /home/xxxxx/public_html/xxxxx/libraries/joomla/database/database/mysql.php:458
9    JError->raiseError()    /home/xxxxx/public_html/xxxxx/libraries/joomla/database/database/mysql.php:231
10    JError->raise()    /home/xxxxx/public_html/xxxxx/libraries/joomla/error/error.php:171
11

Any advise please as I now have two sites with this problem since a VM upgrade

nsw

  • Beginner
  • *
  • Posts: 46
    • Management Consultant
Re: 500 SQL Error
« Reply #4 on: July 31, 2009, 13:46:32 pm »
seems that a few of these 500 server error message are a results of VM vulnerabilties

http://securityreason.com/wlb_show/WLB-2009040001

nsw

  • Beginner
  • *
  • Posts: 46
    • Management Consultant
Re: 500 SQL Error
« Reply #5 on: July 31, 2009, 15:56:49 pm »
missing '' in ps_product_category.php

resolved by adding '' around $catid in the function below in ps_product_category.php

   function get_name_by_catid($catid) {
      $db = new ps_DB;

      $q = "SELECT category_name FROM #__{vm}_category ";
      $q .= "WHERE category_id = '$catid' ";
      $db->query( $q );
      $db->next_record();

      return $db->f('category_name');
   }