GridConnector Problem

Hi,

I am trying to load a grid with server data from a php script. I am using GridConnector in the script. For some reason, render_table() works ok, but render_sql() doesn’t seem to. Please see below code snippet and the result of each case:

Code:

[code] require_once(“…/…/…/dhtmlxForm/06_data/php/connector/grid_connector.php”);
require_once(“config.php”);

//The below if using the dataconnector...
$conn = mysql_connect($mysql_host,$mysql_user,$mysql_pasw);
mysql_select_db($mysql_db);
$data = new GridConnector($conn);

if (isset ($_POST['detail'])){$detail=$_POST['detail'];}
if (isset ($_GET['id'])){$id=$_GET['id'];}
if (isset ($_GET['projid'])){$projid=$_GET['projid'];}

$sql="SELECT userid,comment,datetime from comments WHERE task=".$id." and project=".$projid;

//$data->render_sql($sql,"commentid","userid,datetime,comment");		// <- Does not work
$data->render_table("comments","commentid","userid,comment,datetime");	// <- Does work[/code]

Now for the results of each case:

And:

So, some strange (presumably error indicating item #) number is assigned to the items in the case of render_sql but is fine in the case of render_table (all other fields etc are present and correct).

What is the issue ? Have a feeling it is somethingf basic that I’m overlooking…

Thanks in advance,

Steve

You are using “commentid” as id field. This field need to be included in the SQL select. So change code like next

$sql="SELECT commentid,userid,comment,datetime from comments WHERE task=".$id." and project=".$projid;