Hi there, I'll try to explain myself but what i really want to get maximum value from mysql database. Infact i've five fields called num1, num2 ..... num5 and each field hold an integer. I want to get the field name (i.e. num1 or num2 or ....) holding maximum number. Is it possible using php and if so then pls help me. I thank you all in advance for your help.
It's kind of an awkward database design you have going there but..
$result = mysql_query("SELECT * FROM $thetablename")
$result_array = mysql_fetch_array($result)
rsort($result_array);
echo $result_array[0] . " is the highest of the values.";
Or ... maybe in theory ...
$result = mysql_query("SELECT max(*) as maxnum FROM $thetablename"); list($maxnum) = mysql_fetch_row($result); echo $maxnum;