$sql="SELECT id, (select learning_plan from {learning_learningplan} where id=lp_id) as learning_plan, (select training_name from {learning_training} where id=t_id)
as training_name from {learning_plan_training} ORDER BY $orderby ";
$sql="SELECT id, (select learning_plan from {learning_learningplan} where id=lp_id) as learning_plan,
(select training_name from {learning_training} where id=t_id) as training_name,
(select type_id from {learning_training} where id=t_id) as type_id from {learning_plan_training} ORDER BY $orderby ";
$attributes=$DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND id=?',
array($u_id),$limitfrom=0,$limitnum=0);
}
else{
$attributes=$DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest"',
array($params=null),$limitfrom=0,$limitnum=0);
$attributes=$DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND id=?',array($u_id),$limitfrom=0,$limitnum=0);
}else{
$attributes=$DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest"',array($params=null),$limitfrom=0,$limitnum=0);