Find the answer to your Linux question:
Results 1 to 2 of 2
Hi Guys I am getting this error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    17

    1064 - You have an error in your SQL syntax


    Hi Guys
    I am getting this 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 'limit 0, 20' at line 1

    limit 0, 20

    also I am getting error under my catalog:

    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 ' 20' at line 1

    select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c 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 = '21' order by pd.products_name limit , 20


    then a other one under my order history on my dummy account:

    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 ' 10' at line 1

    select o.orders_id, o.date_purchased, o.delivery_name, o.billing_name, ot.text as order_total, s.orders_status_name from orders o, orders_total ot, orders_status s where o.customers_id = '2' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '1' and s.public_flag = '1' order by orders_id DESC limit , 10


    after installing admin notes and here is my server info:

    Server OS: Linux 2.6.24-19-server Database: MySQL 5.0.51a-3ubuntu5.1
    Server Date: 08/04/2008 16:52:42 Datebase Date: 08/04/2008 16:52:42
    Server Up Time: 16:52:42 up 17 days, 2:41, 0 users, load average: 0.00, 0.00, 0.00
    HTTP Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8
    PHP Version: 5.2.4-2ubuntu5.3 (Zend: 2.2.0)

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    There shouldn't be a comma between limit and the number of lines you wish to limit to. Example
    Code:
    select 	o.orders_id, 
    	o.date_purchased, 
    	o.delivery_name, 
    	o.billing_name, 
    	ot.text 
    as order_total, s.orders_status_name 
    from orders o, orders_total ot, orders_status s 
    where o.customers_id = '2' 
    	and o.orders_id = ot.orders_id 
    	and ot.class = 'ot_total' 
    	and o.orders_status = s.orders_status_id 
    	and s.language_id = '1' 
    	and s.public_flag = '1' 
    order by orders_id DESC 
    limit 10;
    Don't forget your semicolon to close the query. I'm thinking that's what caused the confusion

Posting Permissions

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