Looping

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

designanddev
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Nov 11, 2012 9:18 am

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>";
  }
 
?>

User avatar
simplypixie
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire
Contact:

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).


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron