<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP] NULL Problem</title>
        <description> Here's my code (using MSSQL):

$conn = new COM (&amp;quot;ADODB.Connection&amp;quot;)or die(&amp;quot;Cannot start ADO&amp;quot;);
$conn-&amp;gt;open($connStr); 
$query = &amp;quot;SELECT * FROM TABLE WHERE id = &amp;quot;.$id;
$rs = $conn-&amp;gt;execute($query);

This code works fine, and I retrieve the values like this:

$tmp1 = $rs-&amp;gt;fields(&amp;quot;column1&amp;quot;);
$tmp2 = $rs-&amp;gt;fields(&amp;quot;column2&amp;quot;);
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-&amp;gt;fields(&amp;quot;followup_on&amp;quot;);
if(is_null($tmp)){
	$followup = &amp;quot;&amp;quot;;
}else{
	$followup = $rs-&amp;gt;fields(&amp;quot;followup_on&amp;quot;);
}

//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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php</description>
        <link>http://www.serverphorums.com/read.php?8,485118,485118#msg-485118</link>
        <lastBuildDate>Sun, 26 May 2013 07:52:30 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?8,485118,485158#msg-485158</guid>
            <title>RE: [PHP] NULL Problem</title>
            <link>http://www.serverphorums.com/read.php?8,485118,485158#msg-485158</link>
            <description><![CDATA[ Serge,<br />
<br />
We don't use MSSQL for much, mostly use MySQL...<br />
<br />
But I don't want to switch out all the drivers for this one issue, which is now resolved (thanks Matijn)<br />
<br />
<br />
-----Original Message-----<br />
From: Serge Fonville [mailto:serge.fonville@gmail.com] <br />
Sent: Tuesday, April 24, 2012 1:45 PM<br />
To: Matijn Woudt<br />
Cc: David Stoltz; <a href="mailto:&#112;&#104;&#112;&#45;&#103;&#101;&#110;&#101;&#114;&#97;&#108;&#64;&#108;&#105;&#115;&#116;&#115;&#46;&#112;&#104;&#112;&#46;&#110;&#101;&#116;">&#112;&#104;&#112;&#45;&#103;&#101;&#110;&#101;&#114;&#97;&#108;&#64;&#108;&#105;&#115;&#116;&#115;&#46;&#112;&#104;&#112;&#46;&#110;&#101;&#116;</a><br />
Subject: Re: [PHP] NULL Problem<br />
<br />
Have you considered the PHP MSSQL driver?<br />
<a href="http://www.microsoft.com/download/en/details.aspx?id=20098" target="_blank"  rel="nofollow">http://www.microsoft.com/download/en/details.aspx?id=20098</a><br />
<br />
Kind regards/met vriendelijke groet,<br />
<br />
Serge Fonville<br />
<br />
<a href="http://www.sergefonville.nl" target="_blank"  rel="nofollow">http://www.sergefonville.nl</a><br />
<br />
Convince Google!!<br />
They need to add GAL support on Android (star to agree)<br />
<a href="http://code.google.com/p/android/issues/detail?id=4602" target="_blank"  rel="nofollow">http://code.google.com/p/android/issues/detail?id=4602</a><br />
<br />
<br />
2012/4/24 Matijn Woudt &lt;tijnema@gmail.com&gt;:<br />
&gt; On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz &lt;Dstoltz@shh.org&gt; wrote:<br />
&gt;&gt; Here's my code (using MSSQL):<br />
&gt;&gt;<br />
&gt;&gt; $conn = new COM (&quot;ADODB.Connection&quot;)or die(&quot;Cannot start ADO&quot;);<br />
&gt;&gt; $conn-&gt;open($connStr);<br />
&gt;&gt; $query = &quot;SELECT * FROM TABLE WHERE id = &quot;.$id;<br />
&gt;&gt; $rs = $conn-&gt;execute($query);<br />
&gt;&gt;<br />
&gt;&gt; This code works fine, and I retrieve the values like this:<br />
&gt;&gt;<br />
&gt;&gt; $tmp1 = $rs-&gt;fields(&quot;column1&quot;);<br />
&gt;&gt; $tmp2 = $rs-&gt;fields(&quot;column2&quot;);<br />
&gt;&gt; Etc...<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; Here's the problem - I'm trying to get a date column that I know is<br />
&gt;&gt; NULL, but I can't seem to get my code right:<br />
&gt;&gt;<br />
&gt;&gt; $tmp = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt;&gt; if(is_null($tmp)){<br />
&gt;&gt;        $followup = &quot;&quot;;<br />
&gt;&gt; }else{<br />
&gt;&gt;        $followup = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt;&gt; }<br />
&gt;&gt;<br />
&gt;&gt; //this results in: Catchable fatal error: Object of class variant could<br />
&gt;&gt; not be converted to string<br />
&gt;&gt; //When I try to ECHO the $followup results (and I know the database<br />
&gt;&gt; value is NULL)<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; So confused - any advice?<br />
&gt;&gt;<br />
&gt;<br />
&gt; It's been a long time ago I worked with ADO (Thank god), but shouldn't<br />
&gt; you echo $followup-&gt;value instead of $followup?<br />
&gt; If that's not working, try a var_dump($followup), so you can check<br />
&gt; exactly what it is.<br />
&gt;<br />
&gt; - Matijn<br />
&gt;<br />
&gt; --<br />
&gt; PHP General Mailing List (http://www.php.net/)<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
<br />
-- <br />
PHP General Mailing List (http://www.php.net/)<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>David Stoltz</dc:creator>
            <category>php-general</category>
            <pubDate>Tue, 24 Apr 2012 20:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?8,485118,485157#msg-485157</guid>
            <title>RE: [PHP] NULL Problem</title>
            <link>http://www.serverphorums.com/read.php?8,485118,485157#msg-485157</link>
            <description><![CDATA[ Matijn - it worked! Geez...<br />
<br />
Strange - I don't need the -&gt;value if it actually has a value, only if it's NULL...<br />
<br />
But it works! Thanks!<br />
<br />
-----Original Message-----<br />
From: Matijn Woudt [mailto:tijnema@gmail.com] <br />
Sent: Tuesday, April 24, 2012 1:40 PM<br />
To: David Stoltz<br />
Cc: <a href="mailto:&#112;&#104;&#112;&#45;&#103;&#101;&#110;&#101;&#114;&#97;&#108;&#64;&#108;&#105;&#115;&#116;&#115;&#46;&#112;&#104;&#112;&#46;&#110;&#101;&#116;">&#112;&#104;&#112;&#45;&#103;&#101;&#110;&#101;&#114;&#97;&#108;&#64;&#108;&#105;&#115;&#116;&#115;&#46;&#112;&#104;&#112;&#46;&#110;&#101;&#116;</a><br />
Subject: Re: [PHP] NULL Problem<br />
<br />
On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz &lt;Dstoltz@shh.org&gt; wrote:<br />
&gt; Here's my code (using MSSQL):<br />
&gt;<br />
&gt; $conn = new COM (&quot;ADODB.Connection&quot;)or die(&quot;Cannot start ADO&quot;);<br />
&gt; $conn-&gt;open($connStr);<br />
&gt; $query = &quot;SELECT * FROM TABLE WHERE id = &quot;.$id;<br />
&gt; $rs = $conn-&gt;execute($query);<br />
&gt;<br />
&gt; This code works fine, and I retrieve the values like this:<br />
&gt;<br />
&gt; $tmp1 = $rs-&gt;fields(&quot;column1&quot;);<br />
&gt; $tmp2 = $rs-&gt;fields(&quot;column2&quot;);<br />
&gt; Etc...<br />
&gt;<br />
&gt;<br />
&gt; Here's the problem - I'm trying to get a date column that I know is<br />
&gt; NULL, but I can't seem to get my code right:<br />
&gt;<br />
&gt; $tmp = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt; if(is_null($tmp)){<br />
&gt;        $followup = &quot;&quot;;<br />
&gt; }else{<br />
&gt;        $followup = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt; }<br />
&gt;<br />
&gt; //this results in: Catchable fatal error: Object of class variant could<br />
&gt; not be converted to string<br />
&gt; //When I try to ECHO the $followup results (and I know the database<br />
&gt; value is NULL)<br />
&gt;<br />
&gt;<br />
&gt; So confused - any advice?<br />
&gt;<br />
<br />
It's been a long time ago I worked with ADO (Thank god), but shouldn't<br />
you echo $followup-&gt;value instead of $followup?<br />
If that's not working, try a var_dump($followup), so you can check<br />
exactly what it is.<br />
<br />
- Matijn]]></description>
            <dc:creator>David Stoltz</dc:creator>
            <category>php-general</category>
            <pubDate>Tue, 24 Apr 2012 20:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?8,485118,485138#msg-485138</guid>
            <title>Re: [PHP] NULL Problem</title>
            <link>http://www.serverphorums.com/read.php?8,485118,485138#msg-485138</link>
            <description><![CDATA[ Have you considered the PHP MSSQL driver?<br />
<a href="http://www.microsoft.com/download/en/details.aspx?id=20098" target="_blank"  rel="nofollow">http://www.microsoft.com/download/en/details.aspx?id=20098</a><br />
<br />
Kind regards/met vriendelijke groet,<br />
<br />
Serge Fonville<br />
<br />
<a href="http://www.sergefonville.nl" target="_blank"  rel="nofollow">http://www.sergefonville.nl</a><br />
<br />
Convince Google!!<br />
They need to add GAL support on Android (star to agree)<br />
<a href="http://code.google.com/p/android/issues/detail?id=4602" target="_blank"  rel="nofollow">http://code.google.com/p/android/issues/detail?id=4602</a><br />
<br />
<br />
2012/4/24 Matijn Woudt &lt;tijnema@gmail.com&gt;:<br />
&gt; On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz &lt;Dstoltz@shh.org&gt; wrote:<br />
&gt;&gt; Here's my code (using MSSQL):<br />
&gt;&gt;<br />
&gt;&gt; $conn = new COM (&quot;ADODB.Connection&quot;)or die(&quot;Cannot start ADO&quot;);<br />
&gt;&gt; $conn-&gt;open($connStr);<br />
&gt;&gt; $query = &quot;SELECT * FROM TABLE WHERE id = &quot;.$id;<br />
&gt;&gt; $rs = $conn-&gt;execute($query);<br />
&gt;&gt;<br />
&gt;&gt; This code works fine, and I retrieve the values like this:<br />
&gt;&gt;<br />
&gt;&gt; $tmp1 = $rs-&gt;fields(&quot;column1&quot;);<br />
&gt;&gt; $tmp2 = $rs-&gt;fields(&quot;column2&quot;);<br />
&gt;&gt; Etc...<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; Here's the problem - I'm trying to get a date column that I know is<br />
&gt;&gt; NULL, but I can't seem to get my code right:<br />
&gt;&gt;<br />
&gt;&gt; $tmp = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt;&gt; if(is_null($tmp)){<br />
&gt;&gt;        $followup = &quot;&quot;;<br />
&gt;&gt; }else{<br />
&gt;&gt;        $followup = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt;&gt; }<br />
&gt;&gt;<br />
&gt;&gt; //this results in: Catchable fatal error: Object of class variant could<br />
&gt;&gt; not be converted to string<br />
&gt;&gt; //When I try to ECHO the $followup results (and I know the database<br />
&gt;&gt; value is NULL)<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; So confused - any advice?<br />
&gt;&gt;<br />
&gt;<br />
&gt; It's been a long time ago I worked with ADO (Thank god), but shouldn't<br />
&gt; you echo $followup-&gt;value instead of $followup?<br />
&gt; If that's not working, try a var_dump($followup), so you can check<br />
&gt; exactly what it is.<br />
&gt;<br />
&gt; - Matijn<br />
&gt;<br />
&gt; --<br />
&gt; PHP General Mailing List (http://www.php.net/)<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
<br />
-- <br />
PHP General Mailing List (http://www.php.net/)<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Serge Fonville</dc:creator>
            <category>php-general</category>
            <pubDate>Tue, 24 Apr 2012 19:50:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?8,485118,485137#msg-485137</guid>
            <title>Re: [PHP] NULL Problem</title>
            <link>http://www.serverphorums.com/read.php?8,485118,485137#msg-485137</link>
            <description><![CDATA[ On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz &lt;Dstoltz@shh.org&gt; wrote:<br />
&gt; Here's my code (using MSSQL):<br />
&gt;<br />
&gt; $conn = new COM (&quot;ADODB.Connection&quot;)or die(&quot;Cannot start ADO&quot;);<br />
&gt; $conn-&gt;open($connStr);<br />
&gt; $query = &quot;SELECT * FROM TABLE WHERE id = &quot;.$id;<br />
&gt; $rs = $conn-&gt;execute($query);<br />
&gt;<br />
&gt; This code works fine, and I retrieve the values like this:<br />
&gt;<br />
&gt; $tmp1 = $rs-&gt;fields(&quot;column1&quot;);<br />
&gt; $tmp2 = $rs-&gt;fields(&quot;column2&quot;);<br />
&gt; Etc...<br />
&gt;<br />
&gt;<br />
&gt; Here's the problem - I'm trying to get a date column that I know is<br />
&gt; NULL, but I can't seem to get my code right:<br />
&gt;<br />
&gt; $tmp = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt; if(is_null($tmp)){<br />
&gt;        $followup = &quot;&quot;;<br />
&gt; }else{<br />
&gt;        $followup = $rs-&gt;fields(&quot;followup_on&quot;);<br />
&gt; }<br />
&gt;<br />
&gt; //this results in: Catchable fatal error: Object of class variant could<br />
&gt; not be converted to string<br />
&gt; //When I try to ECHO the $followup results (and I know the database<br />
&gt; value is NULL)<br />
&gt;<br />
&gt;<br />
&gt; So confused - any advice?<br />
&gt;<br />
<br />
It's been a long time ago I worked with ADO (Thank god), but shouldn't<br />
you echo $followup-&gt;value instead of $followup?<br />
If that's not working, try a var_dump($followup), so you can check<br />
exactly what it is.<br />
<br />
- Matijn<br />
<br />
-- <br />
PHP General Mailing List (http://www.php.net/)<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Matijn Woudt</dc:creator>
            <category>php-general</category>
            <pubDate>Tue, 24 Apr 2012 19:50:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?8,485118,485118#msg-485118</guid>
            <title>[PHP] NULL Problem</title>
            <link>http://www.serverphorums.com/read.php?8,485118,485118#msg-485118</link>
            <description><![CDATA[ Here's my code (using MSSQL):<br />
<br />
$conn = new COM (&quot;ADODB.Connection&quot;)or die(&quot;Cannot start ADO&quot;);<br />
$conn-&gt;open($connStr); <br />
$query = &quot;SELECT * FROM TABLE WHERE id = &quot;.$id;<br />
$rs = $conn-&gt;execute($query);<br />
<br />
This code works fine, and I retrieve the values like this:<br />
<br />
$tmp1 = $rs-&gt;fields(&quot;column1&quot;);<br />
$tmp2 = $rs-&gt;fields(&quot;column2&quot;);<br />
Etc...<br />
<br />
<br />
Here's the problem - I'm trying to get a date column that I know is<br />
NULL, but I can't seem to get my code right:<br />
<br />
$tmp = $rs-&gt;fields(&quot;followup_on&quot;);<br />
if(is_null($tmp)){<br />
	$followup = &quot;&quot;;<br />
}else{<br />
	$followup = $rs-&gt;fields(&quot;followup_on&quot;);<br />
}<br />
<br />
//this results in: Catchable fatal error: Object of class variant could<br />
not be converted to string<br />
//When I try to ECHO the $followup results (and I know the database<br />
value is NULL)<br />
<br />
<br />
So confused - any advice?<br />
<br />
-- <br />
PHP General Mailing List (http://www.php.net/)<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>David Stoltz</dc:creator>
            <category>php-general</category>
            <pubDate>Tue, 24 Apr 2012 19:31:13 +0200</pubDate>
        </item>
    </channel>
</rss>
