Re: NULL value question
- From: Paul Lalli <mritty@xxxxxxxxx>
- Date: Tue, 31 Jul 2007 12:15:25 -0700
On Jul 31, 3:04 pm, Jim James <j...@xxxxxxxxxxxxx> wrote:
I'm coding my first web site using a mysql
database and DBI.
I can fetch records from the database
with no problem, but I'm having trouble
testing NULL values. If I load the value
of a date field into a variable ($dateadded),
how should the IF condition be written?
if (!defined $dateadded) {
I found some information that talked
about NULLs being undef, but I'm
not sure how to use that information.
perldoc -f defined
perldoc -f undef
Note if the value in your DB isn't actually NULL, but is instead the
empty string, you'll have to specifically compare to the empty string:
if ($dateadded eq "") {
Paul Lalli
.
- References:
- NULL value question
- From: Jim James
- NULL value question
- Prev by Date: NULL value question
- Next by Date: Re: CGI displays contents of script
- Previous by thread: NULL value question
- Next by thread: Re: NULL value question
- Index(es):
Relevant Pages
|
|