hi all
could any 1 help me out.
im trying to find the biggest id number in a db.
the problem is that the "ID" column is saved as "TEXT"(its important to me).
the language im using is PHP.
10x!

tried to use this but it didnt work

$resultt = mysql_query("SELECT MAX(id) FROM object" , $conn);
$row = mysql_fetch_array($resultt);
$num=$row[maxnum];

A) Why is your ID field TEXT?
B)

SELECT MAX(CAST(id AS DECIMAL)) as id FROM object
commented: sounds good to me. +24

thanx man
i used it as a text because when i started i didnt want to give auto id, and its easier to work on string in php...
but now i do and instead of changing 20 pages i wanted to change the command...
anyway 10x!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.