Populate Combo Box with Data From a Database

I have a Form on a page.

The Form is generated from an XML File.

Inside the form there are a number of Combo boxes currently with no data in them.

How Do I Populate each of these combo boxes with different sets of data from my database.

I have managed to get 2 of the 3 comboboxes populating correctly with the following code

<?php
include_once '../includes/db_connect.php';
include_once '../includes/functions.php';

require_once("../codebase/connector/combo_connector.php");
 
$data = new ComboConnector($res, "MySQL");
$stmt = $mysqli->prepare($data->render_sql("SELECT *, Description as label, Project as value FROM tINF_ProjectList","Project","Description(label),Project(value)"));
?>

However when I use the code below, I get the following error in my browser and nothing loads.

dhtmlx.js:9 Uncaught TypeError: Cannot read property 'getElementsByTagName' of null_xmlToObj @ dhtmlx.js:9n @ dhtmlx.js:9(anonymous function) @ dhtmlx.js:9
<?php
include_once '../includes/db_connect.php';
include_once '../includes/functions.php';

require_once("../codebase/connector/combo_connector.php");
 
$data = new ComboConnector($res, "MySQL");
$stmt = $mysqli->prepare($data->render_sql("SELECT *, WorkDescription as label, WorkType as value FROM INF_WorkTypes",
"WorkDescription"
,"WorkDescription(label),WorkType(value)"));
?>

I have double checked all field names and database names and everything is correct.

Hi,

(a)
Why are you wrapping render_sql call in mysqli->prepare?

(b)
If issue still occurs, try to add the next line before render_sql
$data->enable_log(“data.log”);

As result connector will write a log file with details about used SQL operations and more detailed error info.

Preparing a statement helps prevent SQL injection.

The issue was in selecting all fields it was pulling in a null value and not working out what to do with it.

I used a render table instead.

Preparing a statement helps prevent SQL injection.

Sorry but it has not sense in the above context.
Connector already escapes all incoming data to prevent SQL injections