Hi Folks,
I’m having an issue trying to set the options for a select box via the GridConnector. The problem is that the query for the OptionsConnector doesn’t ever seem to run, no matter what I do. (I’ll probably have some stupid typo or something that I just can’t see).
I have enabled logging… and all I ever see in the logs is the render_sql that happens on the GridConnector.
Here’s the code:
<?php
require("../include/lib/dhtmlx/connector/codebase/grid_connector.php");
if(isset($_REQUEST['id']) && isset($_REQUEST['loc'])){
$rowId = str_replace(",", "','", $_REQUEST['id']);
$dbh = mysql_connect("localhost", "user", "password");
mysql_select_db("somedb");
$gridConn = new GridConnector($dbh, "MySQL");
$optsConn = new OptionsConnector($dbh, "MySQL");
$gridConn->enable_log("grid.log",true);
$optsConn->enable_log("grid.log",true);
$opt_query = "select smash_settings.id as value, smash_settings.name as label ".
"from smash_settings where smash_settings.default_settings=1";
$optsConn->render_sql($opt_query, "", "value,label");
$gridConn->set_options("ioid", $optsConn);
$query = "select 0 as selected, endpoints.uuid as uuid, endpoints.name as epname, endpoints.os_type as ostype, ".
"endpoints.io_program_ver as iover, smash_settings.id as ioid, smash_settings.* from endpoints left join smash_settings on ".
"endpoints.io_settings_id = smash_settings.id where ";
if($_REQUEST['loc'] === "menuA"){
$query .= "endpoints.configid ";
} else if ($_REQUEST['loc'] === "menuC"){
$query .= "endpoints.uuid ";
} else {
exit;
}
$query .= "in ('$rowId') order by endpoints.name";
$fieldset = "selected,epname,ostype,iover,ioid,smash_binary_path,smash_targets_path,smash_patterns_path,".
"smash_stop_error,smash_verify,smash_blocksizes,smash_functions,smash_error_file,".
"smash_display_time,smash_queue_params,smash_other";
$gridConn->render_sql($query, "uuid", $fieldset);
}
?>
If anyone can clue me in, that would be great.
Thanks,
Andy