here is the sql:
$resultc=mysql_db_query("webstat","select Max(cat) from info design");
how can i get the max(Cat)?
thanks
Jackie
get the max value from mysql
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I'd alias the max(cat) if I were you to make it easier....
I have no idea how many records that is returning or what the data is so probably most generically....
I have no idea how many records that is returning or what the data is so probably most generically....
Code: Select all
$resultc=mysql_db_query("webstat","select Max(cat) as m from info design");
$max_cat = array();
while ($row = mysql_fetch_array($resultc)) {
$max_cat[] = $row['m'];
}
print_r($max_cat);- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Code: Select all
$resultc=mysql_db_query("webstat","select Max(cat) as m from info design");
$max_cat = mysql_result($resultc, 0, 'm');