[SOLVED]Help needed in query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

[SOLVED]Help needed in query

Post by dakkonz »

I have a db table of comics titles with a primary index called comicNum and it is auto-incremented.... How can i get the largest value in db???
I tried this but it does not work... does not return anything....
Can anyone help me??

Code: Select all

<?php
$query = "SELECT MAX(comicNum) FROM archive";
$result = mysql_query($query) or die(MySQL_Error());
$row =  mysql_fetch_array($result);
?>
Last edited by dakkonz on Thu Jul 15, 2004 8:37 pm, edited 1 time in total.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

// change...
$row =  mysql_fetch_array($result); 

//...to...
echo mysql_result($result, 0);
Don't forget to look it up in the manual. Have fun. =)
Post Reply