pdoQuery() function
for non-crud queries, returns result set
- custom select statements
- typically execute in the Model Class
Parameters - pdoQuery( sql, option )
- SQL - custom sql statement
- OPTION - if set to true, performs a fetch. ( default: no fetch )
// Example 1 [models/controller] - PHP pdoQuery function
// Note: $this->db - database connector inside the model class
function getStudentList() {
$orgid = Session::get('orgid');
$SQL = "SELECT DISTINCT
p.userid,
p.firstname,
p.lastname
FROM user u
INNER JOIN profile p
ON p.orgid = u.orgid
AND p.userid = u.userid
WHERE u.orgid = {$orgid}
AND u.rolecode = 'STUDENT'
AND u.status = 'A' ";
$ar = $this->db->pdoQuery($SQL, $fetch=false); //do NOT fetch
return $ar;
}