Таблица какая идет на подарки?
Добавлено 24.07.13 в 13:20:47:
$present=mysql_result(mysql_query(\"SELECT COUNT(*) FROM `present_give` WHERE `id_give` = \'$ank[id]\' LIMIT 1\"
,0);
if ($present>4){
$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\' />\";
}}}