Jump to content

Geting max of a mysql field


wepnop

Recommended Posts

I need to get the max of the field called ID, from the table ordenador. This is my actual code:

$cons = "SELECT MAX(ID) FROM `ordenador`";
$maxrow = consultar_bd($cons);
$id_contiene = $maxrow['ID'];

 

consultar_bd is a function that executes a sql query and returns a fetched result as a array.

Link to comment
https://forums.phpfreaks.com/topic/238477-geting-max-of-a-mysql-field/
Share on other sites

Sorry maybe its that my english is bad, but i think i asked it:

 

What  i need is to get the max of the ID value in the ordenador table using php + mysql.  Thats the code i was using but it dont works, when i try to get the ID it says that index dont exist.

 

I need some way to know and store in a php variable what is the higest ID value.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.