ОБСУЖДЕНИЕ

Вывод картинки

10 сообщений0 просмотровЗакрыта
#1
PHP
$qwe = mysql_query("SELECT * FROM `coins` WHERE `podcat` = '$podcat[id]'");
While($coins = mysql_fetch_array($qwe)){
echo '<style>
#coin{      background: url(/style/css/coins/'.$coins['id'].'.jpg) no-repeat;}
</style>';
echo '<div id="coin"></div>';
}

И так... сама ошибка.
На странице 10 монет и у каждой свой ID, это $coins

Берем ID монеты и добавляем ее в стиль #coin.

Так вот, в самом стиле ID монеты выводится ровно, а вот <div id="coin"></div> читает этот стиль как ID последней монеты на странице, то есть ID10.

Помогите исправить :(
#2
$qwe = mysql_query("SELECT * FROM `coins` WHERE `podcat` = '$podcat[id]'");
While($coins = mysql_fetch_array($qwe)){
echo '<style>
#coin-$coins['id']{ background: url(/style/css/coins/'.$coins['id'].'.jpg) no-repeat;}
</style>';
echo '<div id="coin-$coins['id']"></div>';
}

ток с кавычками
#3
KpuTuK, Нет, все равно берет только последний ID
#4
покажи мне html вывод
#5
KpuTuK, http://pscss.ru
Логин: McLaren
Пароль: 111111
На странице:
http://pscss.ru/collection/collpod.php?id=1
#6
-=...Рома...=-,
#coin{ background: url(/style/css/coins/1.jpg) no-repeat;background-size: cover;background-position: 0px 0px;width:48px;height:48px;-webkit-transition: All 0.5s ease;-moz-transition: All 0.5s ease;-o-transition: All 0.5s ease;-ms-transition: All 0.5s ease;transition: All 0.5s ease;z-index: 999;float:left;margin-right: 5px;}
#coin:hover{background: url(/style/css/coins/1.jpg) no-repeat;background-size: cover;background-position: -48px 0px;width:48px;height:48px;cursor: pointer;-webkit-transition: All 0.5s ease;-moz-transition: All 0.5s ease;-o-transition: All 0.5s ease;-ms-transition: All 0.5s ease;transition: All 0.5s ease;z-index: 999;float:left;margin-right: 5px;}
</style><div class="collpod"><span id="coin"></span><a href="coin.php?id=1"><font color="lime"> Полушка (1/4 копейки 1722 года)</font></a><br/>ID монетки: 1</div>


ты не поменял как я говорил
#7
KpuTuK, блин, авторизация слетала, сейчас сделаю
#8
KpuTuK, Спасибо, помогло
#9
-=...Рома...=-, обращайся)
#10
Тему закрыл -=...Рома...=-!
Причина: Критику спасибо. Проблема решена