Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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


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

  // 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
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

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: Google [Bot] and 4 guests