How to use custom sql to populate a dropdown box?

I have this dropdown box which is being populated from a table - lesson_plan.
I want to load only the lessons belonging to a certain teacher by changing the sql to something like SELECT * from lesson_plan where teacher_id = 1 and populate the dropdown box with the lesson_title as label and the lesson_id as value.
This is my php script:

include ('../../common/config_lesson.php');

$list = new OptionsConnector($res, $dbtype);

// $list->render_table(“lesson_plan”,“lp_id”,“lp_id(value),lp_title(label)”);
$list->render_complex_sql(“SELECT * from lesson_plan WHERE lp_owner_id = 1”,“lp_id”,“lp_id,lp_title”);
$scheduler = new schedulerConnector($res, $dbtype);
$scheduler->set_options(“lesson_id”, $list);

Thanks for any idea

I found the answer :slight_smile: :

$list->render_sql(“SELECT lp_id as value, lp_title as label from lesson_plan WHERE lp_owner_id = 1”,“value”,“value,label”);