basic config..forgot..!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
crypdude
Forum Newbie
Posts: 18
Joined: Sun May 23, 2004 10:26 pm

basic config..forgot..!

Post by crypdude »

Now i using easyphp for my php. then when i open my web in localhost then this errors occur. Before there is no problem but now this errors appear..

Notice: Undefined index: login in c:\program files\easyphp1-7\www\idcv1.01\index.php on line 2

Notice: Undefined variable: login in c:\program files\easyphp1-7\www\idcv1.01\index.php on line 4

Notice: Undefined variable: InvoiceMaster in c:\program files\easyphp1-7\www\idcv1.01\header.php on line 21


I thing, i miss up in php setting.. anybody kat help me..??
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

What is on line 2? (or 4, or 21 for that matter).
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

It's just a NOTICE not an ERROR as such ;)
It just means you've got something like $foo['login'] where $foo['login'] isn't set/defined.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

By default NOTICE reporting is off in PHP. To run your scripts without being notified on whether or not a variable has been initialised (just and example), use:

Code: Select all

error_reporting (E_ALL ^ E_NOTICE);
You can safely ignore NOTICES. For more details see [php_man]error_reporting[/php_man].
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

patrikG wrote:You can safely ignore NOTICES.
Essentially yes, but developing your scripts/apps with error_reporting set to 'E_ALL' can save you hours of work when it comes to debugging.

I have seen people spend literally hours trying to work out why their script/function is not returning the expected results, only to discover that the variable they have passed was mispelt.

If your error level is set to 'E_ALL' then you will be immediately alerted to the fact the the mispelt variable does not exist (assuming of course that you have not spelt the varaibale as another one which does exist).

Personally I would recommend you develop your scripts/apps with error_reporting set to 'E_ALL', it does have other uses to apart from that I mentioned above.
User avatar
crypdude
Forum Newbie
Posts: 18
Joined: Sun May 23, 2004 10:26 pm

Post by crypdude »

if set error_reporting(0), then my webpage can't work like normal.. i thinks i miss up on the php configuration itself... wat should i do..??
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Instead of doing stuff like:
if($foo['login']){
....
}

do:
if(!empty($foo['login'])){
....
}
That should prevent those notices.
Last edited by markl999 on Fri Jul 09, 2004 4:28 am, edited 1 time in total.
User avatar
crypdude
Forum Newbie
Posts: 18
Joined: Sun May 23, 2004 10:26 pm

Post by crypdude »

what variable $foo can do? What $foo really is? Thanks!

Actually, before this this same code i use with different computer and different OS, this stuff work... but when i set a new PHP setup(PHP,MySql, phpmyadmin) then this warning appear... Actually this is not just warning at all.. this warning can make my web doesnt work..

I think i miss some configuration for my PHP, actually i'm using easyPHP to ease my PHP configuration...

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

crypdude wrote:what variable $foo can do? What $foo really is? Thanks!
:arrow: WHAT THE HELL IS A $FOOOOO[bar]
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

foobar: n.

[very common] Another widely used metasyntactic variable; see foo for etymology. Probably originally propagated through DECsystem manuals by Digital Equipment Corporation (DEC) in 1960s and early 1970s; confirmed sightings there go back to 1972. Hackers do not generally use this to mean FUBAR in either the slang or jargon sense. See also Fred Foobar. In RFC1639, “FOOBAR” was made an abbreviation for “FTP Operation Over Big Address Records”, but this was an obvious backronym. It has been plausibly suggested that “foobar” spread among early computer engineers partly because of FUBAR and partly because “foo bar” parses in electronics techspeak as an inverted foo signal; if a digital signal is active low (so a negative or zero-voltage condition represents a "1") then a horizontal bar is commonly placed over the signal label.
source :?
User avatar
crypdude
Forum Newbie
Posts: 18
Joined: Sun May 23, 2004 10:26 pm

Post by crypdude »

crypdude wrote: Actually, before this this same code i use with different computer and different OS, this stuff work... but when i set a new PHP setup(PHP,MySql, phpmyadmin) then this warning appear... Actually this is not just warning at all.. this warning can make my web doesnt work..

I think i miss some configuration for my PHP, actually i'm using easyPHP to ease my PHP configuration...
So how?
Post Reply