На пример с моих,переделай под себя
<?
echo \"<div class=\'info\'>\\n\";
echo \"<img src=\'/settings/info/images/present.png\'> <b>Подарки</b> | <a href=\'/present/presentlist.php?user=$ank[id]\'>Все</a> ($prezent)<br />\\n\";
################################################################################
$q=mysql_query(\"SELECT * FROM `present_give` WHERE `id_give` = \'$ank[id]\' ORDER BY time DESC LIMIT 5\"
;
while ($post = mysql_fetch_array($q))
{
if (mysql_result(mysql_query(\"SELECT COUNT(*) FROM `user` WHERE `id` = \'$post[id_user]\'\"
,0) && mysql_result(mysql_query(\"SELECT COUNT(*) FROM `present_list` WHERE `id` = \'$post[id_p]\'\"
,0))
{
$qp=mysql_query(\"SELECT * FROM `present_list` WHERE `id` = \'$post[id_p]\' LIMIT 1\"
;
$p = mysql_fetch_array($qp);
echo \"<img src=\'$p[url]\' width=\'32\' height=\'32\' />\";
}
}
echo \"</div>\\n\";
?>