I have a form that loads contact data for the selected record in a grid, but when I try to use render_sql it fails.
my connector code is as follows:
<?php
require("../codebase/connector/grid_connector.php");
$res=mysql_connect("localhost","vidainte_Grupos",",E^PkQ)-nDa{");
mysql_select_db("vidainte_Grupos");
$gridConn = new GridConnector($res,"MySQL");
//$gridConn->render_table("contacts","contact_id","fname,lname,email");
$gridConn->set_encoding("iso-8859-1");
$gridConn->render_sql("SELECT Usuarios.Nombre as Nombre, Usuarios.Apellido as Apellido, Grupos.Titulo as Grupo FROM Usuarios,Grupos WHERE Usuarios.ID_Grupo=Grupos.ID_Grupo","Usuarios.ID_Usuario","Usuarios.Nombre(Nombre),Usuarios.Apellido(Apellido),Grupos.Titulo(Grupo)");
?>
If I uses render_table, the form loads just fine, but it fails with render sql.
The XML rendered is like this
.
.
.
Please be sure that used SQL code is valid ( looks so )
If problem still occurs - try to enable server side logs
docs.dhtmlx.com/doku.php?id=dhtm … tor:errors
and provide their content.
I created a log file but no error were registered.
The difference in the xml when I use sql render or table render is in the row id:
using sql render:
row id=“1348756923x0”
row id=“1348756923x1”
row id=“1348756923x2”
.
.
.
Using table render:
row id=“1”
row id=“2”
row id=“3”
.
.
.
Change code as
$gridConn->render_sql("... sql code ...","ID_Usuario",
ID must be defined without table name
Thanks!! that partially solved the problem, I also had to add the ID field in the sql
This code is working now:
$gridConn->render_sql("SELECT Usuarios.Nombre as Nombre, Usuarios.Apellido as Apellido,Usuarios.ID_Usuario as ID, Grupos.Titulo as Grupo FROM Usuarios,Grupos WHERE Usuarios.ID_Grupo=Grupos.ID_Grupo","ID","Usuarios.Nombre(Nombre),Usuarios.Apellido(Apellido),Grupos.Titulo(Grupo)");