$sql = "SELECT catgy.category_id, catgy.category_title
FROM categories catgy
INNER JOIN subj_category_relation scr
ON scr.scr_id = catgy.category_id
INNER JOIN subjects subj
ON subj.subject_id = '{$sId}'
WHERE subj.subject_id = '{$sId}'
AND subj.subject_id = scr.subject_id";
$res = $this->db->query( $sql );
if ($res) {
$results = $res->result_array();
echo "<pre>";
var_dump( $results );
echo "</pre>"
exit;
vardump
array(5) {
[0]=>
array(2) {
["category_id"]=>
string(1) "1"
["category_title"]=>
string(5) "terms"
}
[1]=>
array(2) {
["category_id"]=>
string(1) "2"
["category_title"]=>
string(6) "people"
}
[2]=>
array(2) {
["category_id"]=>
string(1) "3"
["category_title"]=>
string(8) "places
"
}
[3]=>
array(2) {
["category_id"]=>
string(1) "4"
["category_title"]=>
string(7) "works
"
}
[4]=>
array(2) {
["category_id"]=>
string(1) "5"
["category_title"]=>
string(8) "events
"
}
}
Getting Database int type in string. What is the proper solution? Instead converting each array may be not good solution.