Исправление кода боя

Тема закрыта
247
.

Вот тут стал переписывать одну пабл линейку.и наткнулся на код с которым борюсь уже какой час.

Откат скилов (+/-)
[php
]$req = mysql_query("SELECT * FROM `users_skills` WHERE `user`='$log' and `type`!='res'");
if(mysql_num_rows($req) > 0){
echo 'Супер удары<br />';
while($mag=mysql_fetch_array($req)){
$skill=$mag['time'] + time();
if($skill < time()){
echo"<img src=\"images/icons_skills/$mag[pic].jpg\" height=15,width=15 alt=\"pic\"/> <a href=\"battle.php?mod=mag&id=$id&id_mag=$mag[id]&amp;startan=$startan&\">".$mag['name']."</a> (Урон: ".$mag['ataka'].", Мана: ".$mag['mp'].")<br/>";
}else{
$otcat=$skill - time();

if($otcat<60){
$otcat = "$otcat сек.";
}elseif($otcat>60 and $otcat<3600){
$otcat=round($otcat/60);
$otcat = "$otcat мин.";
}[/php]

Cуть вопроса в том что при заданных условиях всегда висит осталось $mag['time']
.
сама табла (+/-)
CREATE TABLE IF NOT EXISTS `users_skills` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`ataka` int(20) NOT NULL,
`mp` int(10) NOT NULL,
`sp` int(20) NOT NULL,
`lvl` int(10) NOT NULL,
`otcat` int(10) NOT NULL,
`profa` text NOT NULL,
`type` text NOT NULL,
`pic` text NOT NULL,
`time` text NOT NULL,
`user` text NOT NULL,
`time_stan` int(20) NOT NULL,
`s_type` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=64 ;
.

кажется разобрался тайм текстовый,а откат можно в откат записывать..

.

вот код на добавление

из файла бэттл (+/-)
$otcat = time()+$mag['otcat'];
mysql_query("UPDATE `users_skills` SET `time`='$otcat' WHERE `user`='$log' and `id`='".$_GET['id_mag']."' LIMIT 1");
.
первый пост но исходны (+/-)
$req = mysql_query("SELECT * FROM `users_skills` WHERE `user`='$log' and `type`!='res'");
if(mysql_num_rows($req) > 0){
echo 'Супер удары<br />';
while($mag=mysql_fetch_array($req)){

if($mag['time'] <= time()){
echo"<img src=\"images/icons_skills/$mag[pic].jpg\" height=15,width=15 alt=\"pic\"/> <a href=\"battle.php?mod=mag&id=$id&id_mag=$mag[id]&amp;startan=$startan&\">".$mag['name']."</a> (Урон: ".$mag['ataka'].", Мана: ".$mag['mp'].")<br/>";
}else{

$otcat=$mag['time']-time();

if($otcat<60){
$otcat = "$otcat сек.";
}elseif($otcat>60 and $otcat<3600){
$otcat=round($otcat/60);
$otcat = "$otcat мин.";
}
.

тему можно крыть.разобрался

Всего: 6