Florian wrote:
>error_reporting = E_ALL & ~E_NOTICE
Better yet, leave your warning levels as they are and don't have
uninitialised variables. They are a *bad* thing. Aside from general
sloppiness, they are a security breach waiting to happen. What if someone
initialises one to a dangerous value b
Thursday, March 15, 2001 3:43 AM
Subject: [PHP-WIN] Uninitialized Variables
> Can PHP deal with variables that are not initialized? It is kicking out an
> error when it runs into something that is not defined yet.
>
> mysql_select_db("mydb",$db);
>
> if ($id)
You may use the function isset.
Try this code:
if (!isset($id)) { // variable not set
}
Regards
Darvin
-Original Message-
From: Dwight Sparling [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 3:44 AM
To: [EMAIL PROTECTED]
Subject:[PHP-WIN
What exactly is the error message? I know this sounds stupid, but are you
sure it isn't just a warning? By default, PHP will output all warnings and
errors to standard output (e.g. the browser).
Olivier
>Can PHP deal with variables that are not initialized? It is kicking out an
>error when it
Can PHP deal with variables that are not initialized? It is kicking out an
error when it runs into something that is not defined yet.
mysql_select_db("mydb",$db);
if ($id) { <=Not initialized and PHP
kicks an error?
// query the DB
Thanks!
Dwight
--