CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Problem with LIMIT in SQL (RESOLVED)

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 01/02/2009, 7:38 AM

I am using Mysql and creating a grid which I want to limit the results to 30. I know the query works as I have tried it against the database but.....

When I use it in CCS I get:
Database 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 'LIMIT 0,31' at line 3.

The query is:
SELECT * FROM products LEFT JOIN categories_link ON
products.ID = categories_link.products_id
ORDER BY products.ID desc LIMIT 0,30;

I have no idea what is wrong. Has anyone had this problem before?

I resolved this by creating a new connection and ticking OFF the Limit/Top box. It seems that CCS adds limits by itself if this box is checked.
View profile  Send private message
datadoit
Posted: 01/02/2009, 7:43 AM

Your database connection probably already has the LIMIT property set, so
the query is really:

SELECT * FROM products LEFT JOIN categories_link ON
products.ID = categories_link.products_id
ORDER BY products.ID desc LIMIT 0,30 LIMIT 0,31;
saseow

Posts: 744
Posted: 01/02/2009, 7:46 AM

Hi dataoit, you are dead right. See my change above. Thanks for the input.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.