我有这个过程是我的应用程序的核心,我正在创建,但由于某种原因,我觉得这是最糟糕的方法(本能),我想看看这个过程是否有问题,我我以一种不好的方式接近它!ps代码工作正常,只是重构问题。
过程是:
用户去主页,他们看到他们的最新活动,由其他网站成员(home.php),
//function to bring the latest activities from database
$results=function getUserUpdates($_SESSION['user_id'];
while($row = mysql_fetch_array($results))
{
//another function to format the activities in a social stream
echo formatUpdate($row['user_note'],$row['dt'],$row['picture'],$row['username'],$row['id'],$row['reply_id'],$row['reply_name'],$row['votes_up'],$row['votes_down']);
}
我已将功能代码放入馅饼中。
格式更新功能http://pastie.org/1213958
getUserUpdates 函数http://pastie.org/1213962
编辑这两个函数都来自不同的文件,它们包含在 home.php 中,formatUpdate 来自 functions.php getUserUpdates 来自 queries.php