I am having a small problem making a file "Free", as in it does not count towards a member on of my site. The row in the database is called "free". I basically want this code to check the database to see if a file is free. If it is to give a slightly different result to something that ISNT free (basically saying the file is free instead of it isn't).
I have no idea where i am going wrong, but right now it's jumping past the else statement and only using the code after.
The SQL Structure is:
CREATE TABLE IF NOT EXISTS `torrents` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`info_hash` varchar(20) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`filename` varchar(255) NOT NULL DEFAULT '',
`save_as` varchar(255) NOT NULL DEFAULT '',
`search_text` text NOT NULL,
`descr` text NOT NULL,
`ori_descr` text NOT NULL,
`category` int(10) unsigned NOT NULL DEFAULT '0',
`hits` int(10) unsigned NOT NULL DEFAULT '0',
`times_completed` int(10) unsigned NOT NULL DEFAULT '0',
`leechers` int(10) unsigned NOT NULL DEFAULT '0',
`seeders` int(10) unsigned NOT NULL DEFAULT '0',
`last_action` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`visible` enum('yes','no') NOT NULL DEFAULT 'yes',
`banned` enum('yes','no') NOT NULL DEFAULT 'no',
`owner` int(10) unsigned NOT NULL DEFAULT '0',
`countstats` enum('yes','no') NOT NULL DEFAULT 'yes',
`free` enum('yes','no') DEFAULT 'no',
`req` tinyint(1) NOT NULL DEFAULT '0',
`reseed` enum('yes','no') DEFAULT 'no',
`last_reseed` int(11) NOT NULL DEFAULT '0',
`picone` varchar(255) NOT NULL DEFAULT '',
`pictwo` varchar(255) NOT NULL DEFAULT '',
`picthree` varchar(255) NOT NULL DEFAULT '',
`anonymous` enum('yes','no') NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`),
UNIQUE KEY `info_hash` (`info_hash`),
KEY `owner` (`owner`),
KEY `visible` (`visible`),
KEY `category_visible` (`category`,`visible`),
KEY `leechers` (`leechers`,`seeders`),
KEY `leechers_2` (`leechers`,`seeders`),
KEY `completed_by` (`completed_by`),
FULLTEXT KEY `ft_search` (`search_text`,`ori_descr`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=144427 ;
$downl = ($CURUSER["downloaded"] + $row["size"]);
$sr = $CURUSER["uploaded"] / $downl;
switch (true)
{
case ($sr >= 4):
$s = "w00t";
break;
case ($sr >= 2):
$s = "grin";
break;
case ($sr >= 1):
$s = "smile1";
break;
case ($sr >= 0.5):
$s = "noexpression";
break;
case ($sr >= 0.25):
$s = "sad";
break;
case ($sr > 0.00):
$s = "cry";
break;
default;
$s = "w00t";
break;
}
$sr = floor($sr * 1000) / 1000;
$sr = "<font color='".get_ratio_color($sr)."'>".number_format($sr, 3).
"</font> <img src=\"pic/smilies/{$s}.gif\" alt='' />";
if ($row['free'] == 'yes')
{
?>
<tr><td align='right' class='heading'>Ratio After Download</td><td><del><?php echo $sr;?>
Your new ratio if you download this torrent.</del> <b><font size="" color="#FF0000">[FREE]</font></b>
(only upload stats are recorded)</td></tr>
<?php
}
else
{
?>
<tr><td align='right' class='heading'></td><td>
<b><font color="#FFFF00">Your ratio if you download this torrent wil be: </font></b><?php echo $sr;?> <?=$uped?></td></tr>