Hi All
I am running an sql query to obtain the data for $CaseStudyTitle[] = $row['CaseStudyTitle']; located in the while loop and passed as parameters to the fucntion below. Currently I am displaying only one case study title at anytime. The partner can have many case studies titles how can I display all case study titles for each partner this in the function.
If you have any question please don't hesitate to reply
Thanks in advance
D
while($row = mysql_fetch_array($result))
{
$partners_id[]= $row['web_customised_partners_id'];
$image_value[] = $row['image_id'];
$image_filename_value[] = $row['image_filename'];
$description_value[] = $row['description'];
$url_value[] = $row['url'];
$case_study_id[] = $row['web_customised_partners_case_study_id'];
$CaseStudyTitle[] = $row['CaseStudyTitle'];
$active[] = $row['active'];
$show_in_banner[]=$row['show_in_banner'];
}
$index=0;
function partnerDescription($partner, $description, $url, $case_study_id, $CaseStudyTitle)
{
$result = "<div class='partner_description' id='partner_description_{$partner}'>";
$result .= "<p class='about_customised_partner'>{$description}<br /><br />";
$result .= "<a href='http://{$url}' target='blank'>{$url} </a><br /><br /><a href='/About_ASDAN/Case_Studies/".$case_study_id."'> {$CaseStudyTitle}</a></p>";
$result .= "</div>";
return $result;
}
foreach ($image_value AS $index => $image_values)
{
echo "<div class='partner_image ' id='partner_" .$partners_id[$index]. "'>";
echo "<a href='#' class='show_hide' rel='#slidingDiv'><img src ='/media/library/". $image_filename_value[$index]."' ></a>";
echo "</div>";
$x++;
$remainder = $x % 5;
if ($remainder ==0 )
{
echo "<div class='clear'><!----></div>";
}
if ($x >4 )
{
for ($i=$index-4; $i<=$index; $i++)
{
echo partnerDescription($partners_id[$i], $description_value[$i], $url_value[$i], $case_study_id[$i], $CaseStudyTitle[$i]);
}
echo "<div class='clear'><!----></div>";// clear div after every 5 iterations
$x=0;// reset iteration
}
}// end of for loop
if($remainder !=0)
{
for ($i=$index-$x+1; $i<=$index; $i++)
{
echo partnerDescription($partners_id[$i], $description_value[$i], $url_value[$i],$CaseStudyTitle, $case_study_id[$i], $CaseStudyTitle[$i]);
}
}
?>
</div>
</div>
</div>
<?php
}
}