CodeIgniter Forums
$this->db->select_max('field') - not working?!?! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $this->db->select_max('field') - not working?!?! (/showthread.php?tid=8768)



$this->db->select_max('field') - not working?!?! - El Forum - 05-30-2008

[eluser]einstein[/eluser]
Hi.
So according to this page:
http://ellislab.com/codeigniter/user-guide/database/active_record.html,
I should be able to do this:
$this->db->selectmax('user_id');
$query = $this->db->get("tblusers");
(this code is from my model)
But i get this error:
Call to undefined function: select_max()
Active record is not turned off. I tryed also selectmax() but no luck,
Any suggestions?
Thank you


$this->db->select_max('field') - not working?!?! - El Forum - 05-30-2008

[eluser]Pascal Kriete[/eluser]
[quote author="einstein" date="1212178847"]
$this->db->selectmax('user_id');
$query = $this->db->get("tblusers");
[/quote]

I assume that's just a typo. What version of CI are you running?


$this->db->select_max('field') - not working?!?! - El Forum - 05-30-2008

[eluser]einstein[/eluser]
Hi,
No is not a typo i had the same problem with get_where where get_where dose not work as it should but getwhere works like a charm,
My version is: 1.5.4.
This is what i have now:
$this->db->select_max('user_id');
$query = $this->db->get("tblusers");
This is my error: Fatal error: Call to undefined function: select_max() in /home.....

Thank you


$this->db->select_max('field') - not working?!?! - El Forum - 05-30-2008

[eluser]Michael Wales[/eluser]
Maybe select_max() was added after 1.5.4 (I don't feel like diving into docs to find when it was added). Since the documentation you are referring to is for 1.6.2, might I suggest upgrading?


$this->db->select_max('field') - not working?!?! - El Forum - 05-30-2008

[eluser]einstein[/eluser]
Hi,
Thank you, but i thought of upgrating after your question about the version.
It works great now.

Thank you