[freetds] Re: result of PHP odbc_field_type() call

Frediano Ziglio freddyz77 at tin.it
Sat Jan 3 22:02:04 EST 2004


> 
> I tested your version 0.62rc2. It works the same as with version 0.61 (at 
> least for those two PHP calls we are discussing here):
> * PHP call odbc_field_len() is fine
> * PHP function odbc_field_type() is not working
> 
> I hope it helps for further development.
> Regards,

Without any change (just using CVS, I didn't change anything)

$ cat hello.php
<?php
$odbc = odbc_connect('local','sa','') or die('opps..');
$sql = "select * from syscomments";
echo "Query: $sql\n";
$result = odbc_exec($odbc, $sql) or die("<p>".odbc_errormsg());
 
//while(odbc_fetch_row($result)){
        for($i=1;$i<=odbc_num_fields($result);$i++){
                echo "Column ".odbc_field_name($result,$i)."\n";
                echo "\tlen is ".odbc_field_len($result,$i)."\n";
                echo "\ttype is ".odbc_field_type($result,$i)."\n";
        }
//}
?>

$ php hello.php
Content-type: text/html
X-Powered-By: PHP/4.3.4
 
Query: select * from syscomments
Column id
        len is 4
        type is INTEGER
Column number
        len is 2
        type is SMALLINT
Column colid
        len is 1
        type is TINYINT
Column texttype
        len is 2
        type is SMALLINT
Column language
        len is 2
        type is SMALLINT
Column text
        len is 255
        type is VARCHAR
Column colid2
        len is 1
        type is TINYINT
Column status
        len is 2
        type is SMALLINT

Perhaps I'm only lucky :) Are you sure you are using new version and not
0.61? Usually using PHP there are a mix that's not easy to understand.

freddy77




More information about the FreeTDS mailing list