Hello again all,
I’m having a problem when I try to populate a grid selection box from the db.
I read this tutorial [url]Start DHTMLX Docs
And set my code up as follows
$form_conn = new GridConnector($conn, "MySQL"); $form_conn->enable_log("../connLogs/areaPrefGridConLog.txt"); //create a new options connector to populate the prefrence level selection box $options = new OptionsConnector($conn); $options->enable_log("../connLogs/areaPrefSelGridConLog.txt"); $options->render_table("preference_level","Preference_Level", "Preference_Level,Preference_Description"); // connect the options returned to the correct coloumn in the grid $form_conn ->set_options("Preference_Level",$options); // get the users id and use it to render there selected area preferences $form_conn->render_sql("SELECT lpost_code_prefix.Area_Name, lpost_code_prefix.Area_Code, area_preferences.Preference_Level FROM lpost_code_prefix,area_preferences WHERE area_preferences.Area_Code = lpost_code_prefix.Area_Code AND area_preferences.User_id = $id", "Area_Code", "Area_Code,Area_Name,Preference_Level"); ?>
I noticed that the wrong data was showing in boxes so I checked the log for the connector and found the following:
A session had already been started - ignoring session_start() at C:\wamp\www\codebase\connector\xss_filter.php line 178
Preference_Description FROM preference_level
area_preferences.Preference_Level FROM lpost_code_prefix,area_preferences
WHERE ( area_preferences.Area_Code = lpost_code_prefix.Area_Code
AND area_preferences.User_id = 2)
Done in 0.0085852146148682s
Basically its running the correct query and then running the grid connectors render_sql() query as well and some how overwriting the results.
Where am I going wrong? I’ve tried giving each connector its own DB connection but its made no difference.
I’ve also tried just passing set_options() just an associative array as shown in the tutorial, when I do this I get nothing in the selection boxes and and I’v tried alternating the order in which the functions are called, no difference I’m stumped!
Can anyone help ?, Thanks in advance.