I broke ilug

Jared jared at trios.org
Thu Jan 9 13:10:41 CST 2003


> Real programmers might laugh at my half-arsed
> guesswork, and where I'm right I might be re-stating
> the obvious, but here goes...

Well, it's nice to see the thought process used by a
non-programmer; for someone not knowing PHP or MySQL you gave
an insightful answer. Sometimes we forget that the only thing
separating us is: programmers have simply made more
mistakes.

The mysql error message is clearly saying that the
database connection works (which is good because
that eliminates any connectivity troubleshooting),
but the SQL statement sent to it is returning invalid data.

We assume the phpNuke script itself is working fine (because
it's production quality, not debugging code), so the problem
is _not_ on line 253, but in the database structure itself.

Most likely this is because a MySQL table structure
changed (ie a table was deleted). Line 250 or so should
tell you which table was being accessed. We know all
this because mysql_num_rows is only used to retrieve the
contents from an SQL query which is successfully returned.

A different error message would indicate that the _data_
was invalid, and a third error message would indicate
that the _php code_ was invalid. Thus the solution will be
found by fixing the database, not the data or the code.

HOWEVER because we're looking at sql_layer.php, we're
obviously looking at a database abstraction layer
and line 250 will not clearly indicate WHICH table
is broken, because it will be an anonymous variable
at that point. So, we have to factor in the information
that Seth deleted the nuke_users table. My guess is
that he dropped the entire table instead of emptying
its contents (ie leaving the structure intact). My
proposed solution is to re-insert an empty nuke_users
table, and try logging in again. (UNLESS PHPNuke is able
to recreate such a table automatically, which is good
programming, but an unknown factor presently.)

I see why the other e-mail advised to replace the
theme, but I do not think this is a theme problem, since
PHPNuke themes are flatfiles, not related to the database
except tangentially. However, the author might have encountered
this exact problem before, and it _could_ be the solution,
so I won't discount it entirely!

In programming, there are often intermingled layers of
abstraction so it is difficult to tell that an error
message indicating faulty table structure is caused by an
invalid SQL query which is stored in a borked theme
setting somewhere. But then again, that would be bad
programming practice, to abstract something without
providing an accurate error handler for that layer of
abstraction.

-Jared

> 
> The script "sql_layer.php" has a statement on line
> 253.
> 
> That statement calls some sort of function named
> "mysql_num_rows".
> 
> There is an argument (a piece of secondary data,
> usually in the form of some sort of variable) linked
> to that function.
> 
> The value that is currently in that variable refers to
> a MySQL resource that is not valid - probably because
> it is not present after deleting the table mentioned
> earlier.
> 
> My guess is that something is pointing at something
> that is no longer there. Again, I might be re-stating
> the obvious. (shrug)
> 
> Can you FTP in and download the "sql_layer.php" file
> and open it up with a text editor that has line
> numbers? Might be a source of more clues...
> 
> 
> 
> --- Kurt Kessler <kessler2k at yahoo.com> wrote:
> 
>>Well, i cant log in with my account or creating
>>another one... but there is this tidbit up at top...
>>
>>Warning: mysql_num_rows(): supplied argument is not
>>a
>>valid MySQL result resource in
>>/home/ilugorg/public_html/includes/sql_layer.php on
>>line 253
>>
>>dunno what significance it has, but im sure someone
>>here will know.
>>
>>Kurt
>>
>>--- Eric Rossiter <rossiter at discoverynet.com> wrote:
>>
>>>Evening Lugnuts,
>>>
>>>Help!!!  I was messing with a new theme at
>>
>>ilug.org,
>>
>>>and all of a sudden
>>>I couldn't log into the administrator account
>>>(admin.php). 
>>>
>>>I've spent several hours gooling and trying
>>>different things.  One of
>>>the suggestions, was to delete the nuke_authors
>>>table, which would force
>>>a re-creation of the administrator account when
>>>going to admin.php.
>>>
>>>Well this is true, I'm prompted to create a super
>>>user for the site, and
>>>when I fill out all the info and try to submit I
>>
>>get
>>
>>>the following:
>>>
>>>Warning: mysql_num_rows(): supplied argument is
>>
>>not
>>
>>>a valid MySQL result
>>>resource in
>>>/home/ilugorg/public_html/includes/sql_layer.php
>>
>>on
>>
>>>line 253
>>> 
>>>Any ideas, anyone... anywhere...
>>>
>>>I'm lost at this point and ilug is less than
>>>functional.
>>>
>>>To re-create the whole process:
>>>http://ilug.org/admin.php
>>>
>>>If someone gets it to work, please let me know
>>
>>what
>>
>>>you set for admin
>>>and pass.  =)
>>>
>>>Thanks for your time,
>>>E




More information about the Kclug mailing list