Advanced Search

Results 1 to 2 of 2

Thread: Database Error

  1. #1
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Database Error

    he Guy`s..

    I hope someone can help me on the way ..
    I have a e-commerce php script running.Everything went well, but for a few hours to experiment with the settings I get the following database error on the home page ::

    Could not execute query [Native 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 'AND ProductPrice.price <= 24) AS "1", SUM(ProductPrice.price >= 25 AND ProductPr' at line 1] [User Info: SELECT SUM(ProductPrice.price >= AND ProductPrice.price <= 24) AS "1", SUM(ProductPrice.price >= 25 AND ProductPrice.price <= 49) AS "2", SUM(ProductPrice.price >= 50 AND ProductPrice.price <= 99) AS "3", SUM(ProductPrice.price >= 100 AND ProductPrice.price <= 199) AS "4", SUM(ProductPrice.price >= 200 AND ProductPrice.price <= 499) AS "5", SUM(ProductPrice.price >= 500 AND ProductPrice.price <= 999) AS "6", SUM(ProductPrice.price >= 1000 AND ProductPrice.price <= 1999) AS "7", SUM(ProductPrice.price >= 2000 AND ProductPrice.price <= 4999) AS "8", SUM(ProductPrice.price >= 5000 AND ProductPrice.price <= 9999) AS "9", SUM(ProductPrice.price >= 10000 AND ProductPrice.price <= 10000000000.00) AS "10" FROM Product LEFT JOIN `ProductPrice` AS `ProductPrice` ON Product.ID = ProductPrice.productID AND (ProductPrice.currencyID = "USD") LEFT JOIN `Category` AS `Category` ON Product.categoryID = Category.ID WHERE (((Product.categoryID IS NOT NULL) AND (Product.isEnabled=1))) ORDER BY Product.isFeatured DESC, Product.salesRank DESC, Product.position DESC]

    Unfortunately, I get little support from the people I've downloaded.
    So, I hope someone can help me on the way ..
    Thanks for help
    Roy

  2. #2
    Join Date
    Oct 2008
    Posts
    60
    Thanks
    2
    Thanked 7 Times in 7 Posts

    Default

    You have

    PHP Code:
    SUM(ProductPrice.price >= AND ProductPrice.price <= 24) AS "1" 
    Add a number

    PHP Code:
    SUM(ProductPrice.price >= ?? AND ProductPrice.price <= 24) AS "1" 
    OR a better way, use the BETWEEN statement

    PHP Code:
    SELECT SUM(Product.price BETWEEN 1 AND 24) AS 1, .... 

Bookmarks

Posting Permissions

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