Re: How to output a NULL field?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Com function is just for Windows,I don't kown why some body like use it.:(

2009/8/27 Andrew Ballard <aballard@xxxxxxxxx>:
> On Wed, Aug 26, 2009 at 9:51 AM, David Stoltz<Dstoltz@xxxxxxx> wrote:
>> Sorry - I don't know what you mean by DB class?
>>
>> I'm using Microsoft SQL 2000....with this code:
>>
>> <?php
>> //create an instance of the  ADO connection object
>> $conn = new COM ("ADODB.Connection")
>>  or die("Cannot start ADO");
>> //define connection string, specify database driver
>> $connStr = "PROVIDER=SQLOLEDB;SERVER=xxxx;UID=xxx;PWD=xxxx;DATABASE=xxxx";
>> $conn->open($connStr); //Open the connection to the database
>>
>> $query = "SELECT * FROM eval_evaluations WHERE id = ".$_POST["eval"];
>>
>> $rs = $conn->execute($query);
>>
>> echo $rs->Fields(22); //this is where that particular field is NULL, and produces the error
>>
>> ....
>>
>
> Because you are using COM, you can't use PHP's empty(), isset(), or
> is_null() in your if(...) statement. I've not used COM for much in
> PHP, but I think you'll have to do something like this:
>
> switch (variant_get_type($rs->Fields(22)) {
>    case VT_EMPTY:
>    case VT_NULL:
>        $q4 = '';
>        break;
>
>    case VT_UI1:
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux