Pulling information from DB store in array

I need some help. I am putting together a portfolio site. I have a database full of information include image paths, client id’s, categories and sub categories. What I am trying to do is have a page that when you view a portfolio piece it will show (Client, Date, Status, Title) along with an Image and Pages to the other images in that piece. What I having a problem with is:
I always learned to pull information from a database and store it in an array like this


<?php
$sqli = ("SELECT ImageID FROM images WHERE Cid=$cat_id AND Sid=$sub_id AND clientID=$client_id ORDER BY ImageID ASC LIMIT 1");
$ires = mysql_query($sqli);
while($irow = mysql_fetch_assoc($ires)) {
?>
/*HTML code is here like displaying (client info, title, date, status, 1 image from the table, pages)*/
<?php } ?>

This will pull all rows that pertain to the $sqli variable. I know I can use LIMIT to only grab one row but I want to grab all the info so I can set up how many PAGES will will be associated with $sqli.

Is there another way instead of using WHILE?
Cause if I use this it will repeat the HTML code for all the rows that pertain to the mysql_query.

If you get lost in my description let me know where I lost you and I can help you understand it better. Thanks in advance!