Re: Problem with DB::autoExecute() and NULL
| From: | Andreas Korthaus | Date: | Thu, 07 Oct 2004 10:21:30 +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-14790@lists.php.net to get a copy of this message | ||
Sönke ruempler wrote:
> 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.
Most time I use autoExecute() I have no problem (because I can make sure
that the variables are set), it is only this large wizard. What do you think
of such a workaround:
function remove_null (&$array) {
foreach ($array as $key=>$val) {
if (is_null($val)) {
unset($array[$key]);
}
}
}
$db->autoExecute(
'table',
remove_null($data),
DB_AUTOQUERY_INSERT
);
regards,
Andreas