1

Topic: What am I missing in this code?

Can someone possibly point out what I'm missing here. This code:

http://outgoing.bauchan.org/unix/viewdownloads.txt

is now working fine, and had been doing so until some code tidying I must have made over the last several days sometime, but when I tried to view the categories a short while ago, nothing was displaying within the table. I had to change $result to $dldresult to get things working again. I honestly cannot spot for the life of me why $result would have been reset. Plus, this part:

// If there are no downloads in this category
if (!$db->num_rows($dldresult))
{
        message($lang['download']['Empty category']);
}

was obviously noting the result correctly, as the empty category message was not being displayed, and it displayed the empty category message fine when the ! was removed to toggle the test. So...., if someone could berate me for the obvious muppet moment I'm having, I'd highly appreciate it. big_smile


Cheers,

Matt

Re: What am I missing in this code?

So, what exactly is supposed to be wrong with the code? tongue

3

Re: What am I missing in this code?

Exactly. I can't figure that out. big_smile The code in that link is now working fine. However, the db queries were just using $result for all of the db query results before, (and had been doing so for several months without trouble). I changed them to $result, $catresult and $dldresult respectively a short while ago to isolate them completely. Until I did that, however, the while loop was outputting zilch. I can't honestly see why that last query would have had it's $results, (now renamed to $dldresults), vars content overwritten though.

4

Re: What am I missing in this code?

This is how the code was before I just changed it: http://outgoing.bauchan.org/unix/viewdownloads.orig.txt

That one displayed nothing from the while loop. The table was completely empty.

Re: What am I missing in this code?

So all you did was change $result to something else in several of the queries? And before that, the $db->num_rows check for the downloads worked but no rows came out?
You wouldn't happen to have a query called via a pun_include (or via header.php in general) that uses $result, would you?

6

Re: What am I missing in this code?

Guess who could kick himself now? big_smile Yup. I'd moved the header.php further down, (as it seemed pointless calling the header further up just incase it was going to exit with the message function), and I had done a grep of header.php to check that $result wasn't used in there, but had never twigged to check the one file that was included via header.php. That's another one to go on my list of self inflicted injuries. big_smile

Thanks Smartys. smile

Re: What am I missing in this code?

lol, no problem: it's the least obvious problem you could have tongue