Solved

is_null not working

Posted on 2008-10-14
4
430 Views
Last Modified: 2013-12-13
What's the best way in php to check if a db column is null b/c IS_NULL() is not working for me.
The database is SQL Server 2000
<?php
								if (is_null($row["postForm"])) <-- not working
								{
									echo "<a href=trans.php?travelID=".$row["travelID"]."&destination_id=".$row["destinationID"]."&type=post>Please Complete.</a>";
								}
								else
								{
									echo "VIEW completed form";
								}
							?>

Open in new window

0
Comment
Question by:Isaac
  • 2
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22713830
what about:
if ( $row["postForm"] == null)) 

Open in new window

0
 
LVL 5

Author Comment

by:Isaac
ID: 22713851
That did not work either
0
 
LVL 5

Author Comment

by:Isaac
ID: 22713866
Also, the data type for that column is "bit" so the default is supposed to be zero but it shows null.
That's why I'm checking if it's no.  It's just a "Yes" or "No" column.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22713948
if ( $row["postForm"] . "" != "1"))  
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question