This is my array that is pulled from the DB:

Array
(
[0] => stdClass Object
    (
        [id] => 88
        [category] => banners
        [project] => projectname
        [location] => thames
        [image] => DSC02588.JPG
        [imagepath] => 
        [lastrun] => 2012-07-05 03:04:11
    )

[1] => stdClass Object
    (
        [id] => 89
        [category] => logos
        [project] => projectname
        [location] => auckland
        [image] => rounded_corners.jpg
        [imagepath] => 
        [lastrun] => 2012-07-05 03:04:11
    )

[2] => stdClass Object
    (
        [id] => 90
        [category] => logos
        [project] => projectname
        [location] => auckland
        [image] => DSC02586.JPG
        [imagepath] => 
        [lastrun] => 2012-07-05 03:04:11
    )

[3] => stdClass Object
    (
        [id] => 91
        [category] => logos
        [project] => projectname
        [location] => auckland
        [image] => 2-03-2012 11-54-42 a.m..jpg
        [imagepath] => 
        [lastrun] => 2012-07-05 03:04:11
    )

)

I need to be able to ouput it into html like this:

<?php foreach ($query as $row){ ?>          
        <div class="project grid_2 left">
            <a class="logothumb" href="javascript:void(0)">
            <div class="loading"></div>
            <img class="thumb" src="<?php echo base_url('assets/images') ?>/logo-thumb.jpg" width="135" height="105" alt="logo">
            <div class="imagecopy"><p><span>Brand Name</span><br>Location</p></div>
            <div class="hidden projectname"><?php echo $row->project; ?></div>
            <div class="hidden projectlocation"><?php echo $row->location; ?></div>
            <ul class="hidden imagelist">
                <li><img src="<?php echo base_url('assets/images') ?>/<?php echo $row->image; ?>" ></li>
              <li><img src="<?php echo base_url('assets/images') ?>/<?php echo $row->image; ?>" ></li>
            </ul>
          </a>
        </div>

Thanks for any suggestion and help

EDIT: I am using codeignitor

In my model is simple at this point:

public function get_portfolio()
{
        $query = $this->db->get('portfolio');
        return $query->result();
       }

What I am trying to accomplish is Categories->Projects(grouped by the same project)->Locations(grouped by the same location)-> and their images

Here is what the data may look like:

88 banners projectname location1 DSC02588.JPG 2012-07-05 03:04:11

89 logos projectname auckland rounded_corners.jpg 2012-07-05 03:04:11

90 logos projectname2 auckland DSC02586.JPG 2012-07-05 03:04:11

91 logos projectname auckland 2-03-2012 11-54-42 a.m..jpg 2012-07-05 03:04:11

Here is the table:

  CREATE TABLE `portfolio` (
  `id` int(11) NOT NULL auto_increment,
  `category` varchar(50) NOT NULL,
  `project` varchar(50) NOT NULL,
  `location` varchar(50) NOT NULL,
  `image` varchar(50) NOT NULL,
  `lastrun` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=92 DEFAULT CHARSET=utf8;
link|improve this question

0% accept rate
show us the code for pulling it from the DB please. – Francis Yaconiello yesterday
@user389391 What is the question ? – Moyed Ansari 23 hours ago
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.