include('config.php');
if(isset($_GET['gift'])) {
if(isset($_GET['user'])) {
$us = mysql_real_escape_string($_GET['user']);
$lime = $_GET['lime']*15;
$data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '".$us."' AND (`name` LIKE '%Сувенир%' OR `name` LIKE '%Подарок%' OR `name` LIKE '%Валентинка%' OR `name` LIKE '%Открытка%' OR `name` LIKE 'Ель%' OR `name` LIKE '%Медаль%' OR `name` LIKE '%Статуэтка%') AND `present` != '' AND `cost` < 24 ORDER BY `id` DESC LIMIT $lime");
$cnt = mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '".$us."' AND (`name` LIKE '%Сувенир%' OR `name` LIKE '%Подарок%' OR `name` LIKE '%Валентинка%' OR `name` LIKE '%Открытка%' OR `name` LIKE 'Ель%' OR `name` LIKE '%Медаль%' OR `name` LIKE '%Статуэтка%') AND `present` != '' AND `cost` < 24");
if(mysql_num_rows($data)) { echo '
Сувениры :
'; }
$i = 0;
while($row = mysql_fetch_array($data)) {
$why_gift = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `users` WHERE `login` = '".mysql_real_escape_string($row['present'])."' LIMIT 1"));
echo '';
$i++;
}
if($i < mysql_num_rows($cnt)) {
echo '
Показать еще подарки';
} else {
echo '
Подарков больше нет'.$cnt;
}
}
}