# Pulling information from DB store in array

**URL:** <https://forum.kirupa.com/t/pulling-information-from-db-store-in-array/293665>\
**Category:** programming\
**Created:** [August 1, 2009, 2:28am UTC](https://forum.kirupa.com/t/pulling-information-from-db-store-in-array/293665 "2009-08-01T02:28:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![waverider303](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@waverider303](https://forum.kirupa.com/u/waverider303)\
**Post date:** [August 1, 2009, 2:28am UTC](https://forum.kirupa.com/t/pulling-information-from-db-store-in-array/293665/1 "2009-08-01T02:28:50Z")

</div>

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

<?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!
