Stupid field names cause render_table to fail

I have inherited a mySQL db I’m working on. One of the column names is “città” (with an “a” with a grave accent on it). There is no way I can get it to come up with thre render_table function. Is there anyway I can “AS” it, i.e. città as city, or escape the “à” someway?

You can try to use

$some->render_table(“table”, “id”, “città(citta), other fields…”

which will convert in SQL as

SELECT città as citta

Thanks for the try, but no good!
I get an error just trying to open the aziende_connector.php which is simply:

<?php require_once("config_media.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); require("./dhtmlx/connector/codebase/grid_connector.php"); $grid = new GridConnector($res); $grid->dynamic_loading(100); $grid->render_table("aziende","UniqueId","città(city),codiceDb,RagSoc,Indirizzo,Cap,Agenzia_Albacom,Agente,Stato_Trattativa"); ?>

The moment I remove the “città(city)” column all works well

I even tried doing a:

<?php require_once("config_media.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); require("./dhtmlx/connector/codebase/grid_connector.php"); $grid = new GridConnector($res); $sql = "SELECT uniqueId, ragsoc, cap, city(città) FROM aziende"; $grid->dynamic_loading(100); $grid->render_sql($sql,"uniqueId","ragsoc, cap, city"); ?>

I modded the db_common.php adding
echo “
=============
”.$sql."
=============
";
to then end of the “select_query” functon

but it still fails with an error msg.:

=============
SELECT uniqueId, ragsoc, cap, città as city FROM aziende LIMIT 0,100

Fatal error: Uncaught exception ‘Exception’ with message ‘MySQL operation failed 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 ‘? as city FROM aziende LIMIT 0,100’ at line 1’ in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php:917 Stack trace: #0 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php(630): MySQLDBDataWrapper->query(‘SELECT uniqueI…’) #1 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(434): DBDataWrapper->select(Object(DataRequestConfig)) #2 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(388): Connector->render() #3 C:\inetpub\wwwroot\dhtmlxNew\aziende_connector.php(13): Connector->render_sql(‘SELECT uniqueId…’, ‘uniqueId’, ‘ragsoc, cap, ci…’) #4 {main} thrown in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php on line 917

Try to use the attached version of php connector
connector.zip (59 KB)

Thanks stanislav, but no luck,

if I use:

<?php require_once("config_media.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); require("./dhtmlx/connector/codebase/grid_connector.php"); $grid = new GridConnector($res); $sql = "SELECT uniqueId, ragsoc, cap, città(city) FROM aziende"; $grid->dynamic_loading(100); $grid->render_sql($sql,"uniqueId","ragsoc, cap, city"); ?>

I get:

Fatal error: Uncaught exception ‘Exception’ with message ‘MySQL operation failed 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 ‘?(city) FROM aziende LIMIT 0,100’ at line 1’ in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php:934 Stack trace: #0 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php(645): MySQLDBDataWrapper->query(‘SELECT uniqueI…’) #1 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(440): DBDataWrapper->select(Object(DataRequestConfig)) #2 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(388): Connector->render() #3 C:\inetpub\wwwroot\dhtmlxNew\aziende_connector.php(13): Connector->render_sql(‘SELECT uniqueId…’, ‘uniqueId’, ‘ragsoc, cap, ci…’) #4 {main} thrown in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php on line 934

but even mysql doesn’t like the “città(city)” syntax, If i use the more standard “città as city” I get:

Fatal error: Uncaught exception ‘Exception’ with message ‘MySQL operation failed 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 ‘? as city FROM aziende LIMIT 0,100’ at line 1’ in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php:934 Stack trace: #0 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php(645): MySQLDBDataWrapper->query(‘SELECT uniqueI…’) #1 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(440): DBDataWrapper->select(Object(DataRequestConfig)) #2 C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\base_connector.php(388): Connector->render() #3 C:\inetpub\wwwroot\dhtmlxNew\aziende_connector.php(13): Connector->render_sql(‘SELECT uniqueId…’, ‘uniqueId’, ‘ragsoc, cap, ci…’) #4 {main} thrown in C:\inetpub\wwwroot\dhtmlxNew\dhtmlx\connector\codebase\db_common.php on line 934

Eitherway we get that “?” where the “à” should be: should something be getting “escaped” somewhere (I believe “à” = &E0 ?)

I suspect that problem may be on level of php-mysql driver, which may lost non-ascii characters.
Try to enable log and run the query from the log directly against database

Right! will do, thanks!