これが私のコードです
while($row= mysql_fetch_array($result)) {
$type = $row[0];
$user_from = $row[1];
$operation_to = $row[2];
$time = $row[3];
if($type=="vote") {
echo self::vote_activity($user_from,$operation_to);
}
else if($type=="upload_album") {
// echo self::upload_activity($user_from,$operation_to);
}
else if($type="create_account") {
}
else {
}
}
関数投票活動は
function vote_activity($user_from,$operation_to) {
ob_start();
global $db;
$table = "userinformation";
$data = array("user_id"=>$user_from);
$result = $db->select($table,$data);
while($row = mysql_fetch_array($result)) {
$name = $row[1]." ".$row[2];
}
$table = "photo_gallery";
$data = array("photo_id"=>$operation_to);
$result = $db->select($table,$data);
while($row = mysql_fetch_array($result)) {
$extension = $row[6];
$user_id = $row[0];
}
$source_file_path = basedir."/storage/".$user_id."/".$operation_to.".".$extension;
$height=200;
$width=200;
?>
<div class="vote_activity_div" >
<p class="vote_p"><a><?php echo $name?></a> vote this photo.</p>
<img class="vote_image" src="Create_thumbnail.php?source_file_path=<?php echo $source_file_path;?>&extension=<?php echo $extension; ?>&height=<?php echo $height; ?>&width=<?php echo $width; ?>"/>
</div>
<?php
$vote_activity = ob_get_contents();
ob_clean();
return $vote_activity;
}
問題は、ループの最初の投票 div が親 div から出ている間に、この vote_activity クラスを複数回呼び出すとです。