ok
I've got a table "image" with image names and also a column called "sec_id" that holds the number of the section that the image belongs in and a column called "ima_rank" that is the rank of each image within the section - the ima_rank is used to sort the order in which the images will be displayed
so, section 1 has a sec_id of 1 and contains ten images ranked 1 - 10
section 2 has a sec_id of 2 and contains 6 images ranked 1 - 6
if I want to add an image into section 2, I want the ima_rank to be 7 - but when I use
$query_max = "SELECT MAX(ima_rank) AS ima_rank FROM image WHERE sec_id='$sec_id'";
to get the highest ima_rank in section 2 it always returns 11 which is the highest rank in the whole table and not just in section 2
so what would i need to do to find the highest rank of only the records with a sec_id of 2
the table looks like this :
CREATE TABLE `image` (
`ima_id` int(11) NOT NULL auto_increment,
`sec_id` int(11) NOT NULL default '0',
`ima_file` tinytext NOT NULL,
`ima_text` text NOT NULL,
`ima_online` tinyint(4) NOT NULL default '0',
`ima_rank` tinyint(4) NOT NULL default '0',
KEY `ima_id` (`ima_id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;
i hope that's enough info
thanks