Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2012
    Posts
    94
    Plugin Contributions
    0

    Default I need some help with a SQL error

    I need some help with a PHP error. I'm on zencart version 1.5.0.


    PHP Fatal 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 'order by' at line 7 :: select p.products_image, p.products_weight, pd.products_name, p.products_quantity, p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
    from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p2c.products_id = s.products_id
    where p.products_status = 1
    and p.products_id = p2c.products_id
    and pd.products_id = p2c.products_id
    and pd.language_id = '1'
    and p2c.categories_id = '519' order by p.products_date_added DESC order by in /includes/classes/db/mysql/query_factory.php on line 101

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: I need some help with a SQL error

    Quote Originally Posted by sw1138lr View Post
    select p.products_image, p.products_weight, pd.products_name, p.products_quantity, p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
    from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p2c.products_id = s.products_id
    where p.products_status = 1
    and p.products_id = p2c.products_id
    and pd.products_id = p2c.products_id
    and pd.language_id = '1'
    and p2c.categories_id = '519' order by p.products_date_added DESC order by
    You have two order-by clauses in your query.
    You'll need to fix your PHP code in your addons and customizations, to remove the extra one that you're adding.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v151 Need some help building a looping SQL query to fill an array.
    By Chris Stackhouse in forum General Questions
    Replies: 2
    Last Post: 3 Sep 2015, 08:19 PM
  2. v150 Need some sidebox and sql help
    By PrymlUrg in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 16 Oct 2012, 04:59 AM
  3. Need help with import a large SQL database
    By shahram in forum General Questions
    Replies: 0
    Last Post: 30 Dec 2009, 11:24 AM
  4. Need Help with SQL error
    By kevinmc3 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 4 Apr 2008, 07:31 AM
  5. Install SQL Patches Error Message - Need Help
    By guys123 in forum General Questions
    Replies: 5
    Last Post: 16 Mar 2008, 05:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg