NULL Problem
| From: | David Stoltz | Date: | Tue, 24 Apr 2012 17:29:39 +0000 |
| Subject: | NULL Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-317667@lists.php.net to get a copy of this message | ||
Here's my code (using MSSQL):
$conn = new COM ("ADODB.Connection")or die("Cannot start ADO");
$conn->open($connStr);
$query = "SELECT * FROM TABLE WHERE id = ".$id;
$rs = $conn->execute($query);
This code works fine, and I retrieve the values like this:
$tmp1 = $rs->fields("column1");
$tmp2 = $rs->fields("column2");
Etc...
Here's the problem - I'm trying to get a date column that I know is
NULL, but I can't seem to get my code right:
$tmp = $rs->fields("followup_on");
if(is_null($tmp)){
$followup = "";
}else{
$followup = $rs->fields("followup_on");
}
//this results in: Catchable fatal error: Object of class variant could
not be converted to string
//When I try to ECHO the $followup results (and I know the database
value is NULL)
So confused - any advice?