CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 strange sort error [solved]

Print topic Send  topic

Author Message
frankthefixer

Posts: 52
Posted: 08/07/2008, 5:43 AM

CCS3.0.1.5
I have a grid published online tied to a hosted mysql table. All the column headings sort the grid ok except one- when clicking the sorter/column heading for one of the columns i get an error-
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 'Condition LIMIT 0,50' at line 1
When making the project in CCS i never even went into that cell- it is untouched since the builder made the grid. all other sorts work fine.

I've searched for that "Condition Limit 0,50" in all files and did not find it- i've backed up the ftp for the whole site- searched all of that for that line, and it does not exist. I've also dropped and re-created the table and still the sort crashes with that error- any ideas?- do i have to re-make my project? i'm feeling that it's not a project related problem. thanks
View profile  Send private message
wkempees


Posts: 1679
Posted: 08/07/2008, 1:41 PM

Frank gave me the site URL and FTP access.
After testing the grid sort, found:
the problem is the column "Condition", it is generating the error.
Condition is a reserved word therefore the SQL is considered wrong.

Option 1, remove the sort for column Condition.
Option 2, change fieldname in database table, from "Condition" to something else f.i. "Cond"
Re-populate, Regenerate the grid and it will work.
Option 3: Add the following code to the Before Execute Select of the Grid:

  
 if ( strstr($Component->DataSource->Order,"Condition") ) // test if order by "Condition"  
      $Component->DataSource->Order = str_replace("Condition", "`Condition`", $Component->DataSource->Order);  
  

It will `backtick` the order field (Condition) and the problem will disappear, magically!

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
frankthefixer

Posts: 52
Posted: 08/07/2008, 1:49 PM

as usual- wkempees saves the day- i will make the changes soon and report back if any problems.
never met this issue before- you know i'll be googling "reserved words" mysql
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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