Welcome Guest, Not a member yet? Register   Sign In
How to get value of select_max function
#1

[eluser]Unknown[/eluser]
Sorry if my question is too basic Smile

I have this code:

$this->db->select_max('id');
$query = $this->db->get('users');
$row = $query->result();
foreach ($query->result() as $row)
echo 'MAX ID='.$row->id; //---> return only one value, so not need for loop?

Function select_max will return ONLY ONE value
So, how to get this only one value instead of use foreach (a loop) or while loop ?

Thank you much!
#2

[eluser]rogierb[/eluser]
It is all in the user_guide, read the section bout "Generating Query Results"
#3

[eluser]Unknown[/eluser]
[quote author="rogierb" date="1256742417"]It is all in the user_guide, read the section bout "Generating Query Results"[/quote]
Thank you, It's clear!




Theme © iAndrew 2016 - Forum software by © MyBB