这是我的代码
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;
}
问题是,当我多次调用此 vote_activity 类时,循环的第一个投票 div 离开了父 div。