Search code examples
phpmysqlcodeignitertrygetvalue

CodeIgniter get value from Max


How to get value from MAX('table')?

This is the code

Array
(
    [0] => stdClass Object
        (
            [applicant_id] => A001
            [MAX(education_type)] => 6
        )
)

To get the value from 'applicant_id' i simply using this

foreach ($results as $row) {
echo "<td>";
echo $row->applicant_id;
echo "</td>";
}

but it is failed when i try to echo $row->education_type; any idea?


Solution

  • Have you try this one?

    echo $row->{"MAX(education_type)"}