fetching one result from mysql
- June 29th, 2008
- Write comment
usually we use mysql queries to retrieve largeĀ data contents.
But sometimes all we need is a number (Max, Count, or maybe just to retrieve unique feild). so we wont need to create an array.
to do so we can try the following code
$query=”select max(‘num’) from table”;
$result=mysql_query(query);
//now the magic line
$MaxNum=mysql_result($result,0,0)
there must be a reason for the 0, 0 but actually I dont know. if you know and can help me then I will be grateful.