Re: Php undefined variable



On 2010-06-12, David Bolt <blacklist-me@xxxxxxxxxx> wrote:
On Friday 11 Jun 2010 17:27, while playing with a tin of spray paint,
Vahis painted this mural:

which gives a 'PHP Notice: Undefined variable' in Apache error log.

Have you checked to see where $days and $uptimeString are defined?

Tried, yes. Php just isn't in my set of skills :(
It's a script that I found long ago, it used to have no errors AFAIR
but after some php version change there's been this notice.

<snip>

So was I, although I've improved a little bit[0] since the last time I
posted here about PHP and databases[1].

I remember that. That's roughly when I noticed that programming is not
necessarily my cup of tea.
Purchasing a two inch thick book about Php5/MySQL didn't get me
anywhere.

It looks great in the book shelf though.

Try calling the script using the command line.

That gives the same as Apache log. It says
PHP Notice: Undefined variable: uptimeString in uptime.php on line 21

When I look at line 21 in Kate I don't know what the fault there is.
Instead of pasting the whole code here it can be seen at
http://waxborg.servepics.com/testsite/uptime.php

Another useful thing is to use the cli version to do a syntax check:

davjam@moray:~/sync> php -l test.php
No syntax errors detected in test.php

I get the same.

I've found it comes in very useful when writing big scripts and I
manage to miss off a ';' somewhere.

Great tip for the future :)

[1] I still see spiders looking at director.php and the various sorting
options that were posted :)

I went to OpenDB at that time, rolling my own turned out to be
impossible.
http://waxborg.servepics.com/OpenDb

There were some notices in there, too, after php version change.
I found them and was able to fix them then though.

Vahis
--
http://waxborg.servepics.com
openSUSE 11.2 (x86_64) 2.6.31.12-0.2-default
09:06am up 39 days 13:18, 13 users, load average: 0.11, 0.05, 0.06
.



Relevant Pages

  • PHP SCRIPT
    ... php classified script ... guestbook ardguest free php guestbook script ... php file upload script ...
    (sci.chem.labware)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)
  • How best to show PHP source? (was: One page, multiple submit buttons)
    ... script to add to the top of a PHP script to enable showing its ... Maybe anybody submitting their own PHP code for critique here ... Anything posted to a newsgroup is a "snapshot" of what the ... there ought to be a FAQ for this ...
    (comp.lang.php)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... thinking about rewriting my whole script in a C language. ... execution of the code. ...
    (php.general)