Change an old code to newer

Started by Payaa, December 16, 2012, 05:10:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Payaa

Hi all!

I want to change the current seeding/leeching older code to a newer that is already in in the U-232 code.

I wanna change this:

$res = sqli_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id WHERE userid=$id AND seeder='no'") or sqlerr();
if (mysqli_num_rows($res) > 0)
  $leeching = maketable($res);
$res = sqli_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id WHERE userid=$id AND seeder='yes'") or sqlerr();
if (mysqli_num_rows($res) > 0)
  $seeding = maketable($res);


To this:
$res = sqli_query("SELECT p.torrent, p.uploaded, p.downloaded, p.seeder, t.added, t.name as torrentname, t.size, t.category, t.seeders, t.leechers, c.name as catname, c.image FROM peers p LEFT JOIN torrents t ON p.torrent = t.id LEFT JOIN categories c ON t.category = c.id WHERE p.userid=".sqlesc($id)) or sqlerr(__FILE__,__LINE__);
        while ($arr = mysqli_fetch_assoc($res))
        {
            if ($arr['seeder'] == 'yes')
                $seeding[] = maketable($arr);
            else
                $leeching[] = maketable($arr);
        }


The current leeching is shown ok but the seeding is just shown Array(). I try lot of things, rewrite the select query, change with the old and so on, but nothing just shown Array().

Anybody know wtf mistake on it???