473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

html display for date with null value

I have some date fields which in some records will have NULL value.

I am trying to show nothing in the HTML display.

IF
<?
$date3=$myrow[when3'];
?>
<p><?=$date3?><p>
The html display is 0000-00-00 if there is no date value in the db table. I
am trying to have nothing displayed for $date3

IF
<?
$date3 = $myrow['when3'];
if($date3="0000-00-00"){$date3="";}
else {$date3=$date3;}
?>
<p><?=$date3?><p>
Nothing is displayed in the page even if a date value has been inserted into
the db table

How can I achieve this?

Louise

Jul 16 '05 #1
2 6071
you only have a single '=' in the 'if' statement
This is assigning the value, not comparing it - will always return TRUE

=)
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:9j********************************@4ax.com...
On Sun, 17 Aug 2003 07:01:22 GMT, "boclair" <bo*****@bigpond.net.au> wrote:
I have some date fields which in some records will have NULL value.

I am trying to show nothing in the HTML display.

IF
<?
$date3=$myrow[when3'];
?>
<p><?=$date3?><p>
The html display is 0000-00-00 if there is no date value in the db table. Iam trying to have nothing displayed for $date3

IF
<?
$date3 = $myrow['when3'];
if($date3="0000-00-00"){$date3="";}
else {$date3=$date3;}
?>
<p><?=$date3?><p>
Nothing is displayed in the page even if a date value has been inserted intothe db table

How can I achieve this?
Sounds like it's your data in the table that's wrong in the first place;

if your date really is NULL, you should get an empty string back.

What database are you using, what datatype is the column, and is it really NULL or actually set to 0000-00-00?

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

Jul 16 '05 #2
> > ><?
$date3 = $myrow['when3'];
if($date3="0000-00-00"){$date3="";}
else {$date3=$date3;}
?>
<p><?=$date3?><p>


"Jeremy Elliot" <je**********@paradise.net.nz> wrote in message
news:zy*********************@news02.tsnz.net... you only have a single '=' in the 'if' statement
This is assigning the value, not comparing it - will always return TRUE

=)


Jeremy, I had a very bad day. I was not only misreading tables but I was
doing things like this, failing to match brackets and on and on. Somedays I
would rather have any job but the one I've got.
Thanks, Louise

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
1
by: Smitty | last post by:
From the psql command line, I am having absolutely no problems inserting a NULL value into a date datatype field. When attempting to insert a NULL value via my Web app using SQL Relay, I am...
3
by: Liam Mac | last post by:
Hi All, Can anyone direct me or provide advice on how I can assign a null value to a date variable in vb.net. Basically what I'm doing is that I'm looping through a recordset where I have three...
8
by: Keijo82 | last post by:
Hi, What kind of query I should do if I have table like below and I want to get last written values both tanks? Not null values ( - equals null values). id date tank number1 ...
2
by: shar7 | last post by:
Hi, I am new to SQL and I need help to display null value as 0. Problem description: The query is to display Branch Code, Branch Location, Account Type Code, account Type Description and Total...
1
by: billa856 | last post by:
Hi, I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date. I am using "" to insert Null in that column(ShipDate)...
1
vikas251074
by: vikas251074 | last post by:
When the page loads default date is displayed in both date field. Can I set null value in expected return date just after selecting 'NR' Not returnable in list? Is there any idea? ...
0
prabirchoudhury
by: prabirchoudhury | last post by:
CRITERIA; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+...
1
by: neelsfer | last post by:
Is there a way of making a Date/time field in a table a "null value"? I would like to have "long time" as a null value. 05/12/2010 12:38:31 PM. Reason - to add up all the fields with "null values"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.