Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Looping

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Looping

Postby designanddev » Sun Dec 30, 2012 1:54 am

i am trying to loop through two series of classes at the same time, heres the code is below. is this possible

Code: Select all
<?php
  // Find all the photos
    $photos = Photograph::find_all();
  $text = Category::get_category();
 
  foreach ($photos as $photos){

  echo $photos->caption;
  echo $photos->category();
  echo $text->category_name;
  echo "</br></br>";
  }
 
?>
designanddev
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sun Nov 11, 2012 9:18 am

Re: Looping

Postby simplypixie » Wed Jan 02, 2013 12:23 am

It is a bit difficult to say without seeing the code for the methods in your classes (for example what exactly is returned to this page for each method you are calling as that will have a bearing on whether or not what you are trying to do will work).
User avatar
simplypixie
php-forum Active User
php-forum Active User
 
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 8 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.