Skip to Content.
Sympa Menu

freetds - [freetds] PHP und Freetds

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Christian" <foren AT habmalnefrage.de>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] PHP und Freetds
  • Date: Fri, 21 Mar 2008 09:46:22 +0100

Hello

My Configuration
SUSE 10.3
PHP 5.2.4
Apache 2.0 Handler
Freetds 0.65 dev. 20070819-6.2

I need access to a MS SQL Server 2005 running under Windows 2003. I try it
with freetds and unixodbc

With ISQL on the commandline I get all Value out of the Database
For Example

Code:
isql -v srvsql 'Domain\username' password
Code:
select description from job where no_='20-100'

here I get the value of the field description

When I try it with php Code

PHP CODE:
<?php
$connect = odbc_connect("srvsql", "spirk\fic", "Zxpjr8tu");

if ($connect > 0) {
print ("Connection ok\n");
}
$query = "select description from job where no_='20-100'";

$result = odbc_exec($connect, $query);

echo odbc_num_rows($result);

# fetch the data from the database
while(odbc_fetch_row($result)) {
$field1 = odbc_result($result, 1);
$field2 = odbc_result($result, 2);
print("$field1 $field2\n");
}

?> when I start then php script on the bash
Code:
php -q dateiname.php
I get return the following message

Code:
Connection ok
-1

The value "-1" is the result of echo odbc_num_rows($result);

In short words
With ISQL I get all infos that I want, with php I get the name of the
tables, but no values in the tables.

Maybe someone has a solution why it work on the commandline (isql) and fails
with PHP.


Many thanks and a happy weekend

Christian



Mit freundlichen Grüßen


Fimberger Christian

SPIRK & PARTNER
Ziviltechnikergesellschaft m.b.H.

Bayerhamerstraße 14
A-5020 Salzburg

T +43 (0)662 64 20 12 - 239
F +43 (0)662 64 60 12
M +43 (0)699 16 64 20 39
e-mail: <mailto:c.fimberger AT spirk.at>
web: <http://www.spirk.at>






Archive powered by MHonArc 2.6.24.

Top of Page