Solved

is_null not working

Posted on 2008-10-14
4
432 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 143

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 143

Accepted Solution

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 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