Re: Problem with DB::autoExecute() and NULL
| From: | Andreas Korthaus | Date: | Thu, 07 Oct 2004 09:40:52 +0000 |
| Subject: | Re: Problem with DB::autoExecute() and NULL | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14788@lists.php.net to get a copy of this message | ||
Hi!
Sönke ruempler wrote:
>> INSERT INTO data
>> (id,title,data,number)
>> VALUES
>> (123,'my data',NULL);
>
> It's a feature. But you code is unclean if you try to call undefined
> variables. So maybe you want to enable E_NOTICE errors in you test
> enviroment and check were your code is unclean.
The problem is, that I want to be able to store the form-data of a wizzad,
also if someone only filled out half of the wizzard. In that case, some
session-variables are not set, yet. If I use this like:
INSERT INTO data
(id,title,data,number)
VALUES
('".escape($_SESSION['id'])."','".escape($_SESSION['data'])."','".escape($_S
ESSION['number'])."');
This works, because PHP converts the NULL to ''. So I do not need to handle
this.
If I want to handle this, I have to write a lot of extra code, where I do
not really see any benefit from. If I call undefinded, global variables, or
GPC-variables I understand the problem, with session-data I don't.
regards
Andreas