您好,我正在尝试在 php 中使用 while 循环创建函数,但无法在这里编写是我的代码
function mail_detail($mail_detail){
$data= mysql_query("select * from messages where messages.to = '$mail_detail' and to_viewed = 0 ORDER BY messages.id DESC");
while ($result= mysql_fetch_array($data)){
return $result;
}
}
输出是
$mail_detail= mail_detail($userid)
echo '<li class="read">
<a href="#">
<span class="message">'. $mail_detail['title'].'</span>
<span class="time">
January 21, 2012
</span>
</a>
</li>';
我没有得到所有的值,只是得到一个值,请帮助 thx