Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andreas Schlögl <andreas.schloegl AT aon.at>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Re: result of PHP odbc_field_type() call now solved
  • Date: Sun, 4 Jan 2004 13:02:36 +0100

> 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

You are not lucky, you are right! It works the same here, but I recognized
that your output is e.g. 'INTEGER' and not 'int', so I had to upgrade my PHP
script, too. Each ODBC driver does it a little different.
I will stay on version 0.62rc2 for further development. So far I can not
report any problems in my configuration.
Thank you!

Andreas
--
MFG
Andreas Schlögl
Softwarelösungen & Consulting
PGP-key availabe for download
http://members.aon.at/asl/publicPGP_key.asc
Home Office, Suse Linux 8.2




  • [freetds] Re: result of PHP odbc_field_type() call now solved, Andreas Schlögl, 01/04/2004

Archive powered by MHonArc 2.6.24.

Top of Page