All pastes #507115 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-24 12:06 UTC
rendered paste body
/*
This is assuming your DB tables are setup similar to this:

//Image Caption Table
image_id
caption


//Image Title Table
image_id
title

// image_id must be the same value in both tables per image
*/

while( $imageRow = mysql_fetch_assoc($imgResult) ) {
  $data[$imageRow['image_id']['caption'] = $imageRow['caption'];
}

while( $row = mysql_fetch_assoc($result) ) {
  $data[$imageRow['image_id']['title'] = $row['title'];
}


foreach( $data as $singleElement ) {
   echo $singleElement['title'] . "<br />";
   echo $singleElement['caption'] . "<br />";

}


// SELECT * FROM projects LEFT JOIN projectImages ON projects.ID = projectImages.projectID or such.