I am trying to create a web with the framework PHPGrid , and I need the options of select are from a query [select u_id, name from teachers] where my name is also selected if the u_id is equal to the session.
I know it must be an array, but I do not know how to develop it.
$class_query = "SELECT * FROM class_view";
$grid["caption"] = "Asignaturas";
$grid["sortname"] = 'curso';
$grid["sortorder"] = "ASC";
$grid["reloadedit"] = true;
$grid["rowNum"] = 20;
$grid["height"] = "auto";
$list_q = new jqgrid($db_conf);
$list_q->set_options($grid);
$list_q->table = "alumnos";
$list_q->select_command = $class_query ;
$col = array();
$col["title"] = "c_id";
$col["name"] = "c_id";
$col["editable"] = true;
$col["hidden"] = true;
$class_cols[] = $col;
$col = array();
$col["title"] = "Curso";
$col["name"] = "curso";
$col["width"] = "70";
$col["align"] = "center";
$col["editable"] = false;
$col["required"] = false;
$class_cols[] = $col;
ol;
$col = array();
$col["title"] = "Profesor:";
$col["name"] = "p_id";
$col["width"] = "80";
$col["align"] = "center";
$col["editable"] = true;
$col["required"] = false;
$col["edittype"] = "select";
$col["editoptions"] = array("value"=>'1 : profuno;2 : profdos;3 : proftres;4 : profcuatro;5 : profcinco;');
$class_cols[] = $col;
$col = array();
$col["title"] = "Editar";
$col["name"] = "act";
$col["width"] = "60";
$col["search"] = false;
$col["sortable"] = false;
$class_cols[] = $col;
$list_q->set_columns($class_cols);
$list_q->set_actions(array(
"add"=>false,
"edit"=>true,
"delete"=>false,
"clone"=>false,
"rowactions"=>true,
"search" => "advance",
"showhidecolumns" => false,
"view" => true
)
);
$outlist = $list_q->render("list100");