[freetds] no-PHP

Rich Young rich at experienceplus.com
Thu Jul 27 11:53:39 EDT 2006


Okay, I don't see anything obviously wrong here except that I'm not sure
if it is OK to use mssql_num_rows($result) when $result was initialized
with odbc_exec.  Maybe try commenting that line out and see if it works
then?

If that's not it, then the error log idea is my best one.

--------------------------
I'm Rich Young, and I approved this message.
 

> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org 
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Usman
> Sent: Wednesday, July 26, 2006 5:42 PM
> To: 'FreeTDS Development Group'
> Subject: Re: [freetds] no-PHP
> 
> Here the test code.
> 
> 
> <?php
> // connect to a DSN "MSSQLTest" 
> 
> print_r("we are trying to connect");
> $connect = odbc_connect("MSSQLTest", "test_user", "passX") or 
> die ("couldn't connect");
> 
> print_r($connected);
> 
> // 	***query the users table for all fields***
> $query = "SELECT * FROM localTable";
> 
> // 	***perform the query****
> $result = odbc_exec($connect, $query);
> 
> //   ***successfully ran query***
> //   ***fetch the data from the database***
> 
> $temp = mssql_num_rows($result) ;
> print_r("display the number of records". $temp );
> 
> while(odbc_fetch_row($result)) {
> $field1 = odbc_result($result, 1);
> $field2 = odbc_result($result, 2);
> print_r("$field1 $field2\n");
> }
> 
> print_r("displayed results");
> 
> # close the connection
> odbc_close($connect);
> ?>
> 
> 
> 
> > -----Original Message-----
> > From: freetds-bounces at lists.ibiblio.org [mailto:freetds- 
> > bounces at lists.ibiblio.org] On Behalf Of Rich Young
> > Sent: Wednesday, July 26, 2006 1:04 PM
> > To: FreeTDS Development Group
> > Subject: Re: [freetds] no-PHP
> > 
> > Do you want to show us some code?  And have you looked in 
> your error 
> > logs?  PHP has a setting that supresses user-visible error messages 
> > for security reasons; if your server is configured in that 
> manner, you 
> > might be missing some pretty informative info in the logs.
> > 
> > --------------------------
> > I'm Rich Young, and I approved this message.
> > 
> > 
> > > -----Original Message-----
> > > From: freetds-bounces at lists.ibiblio.org 
> > > [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Usman
> > > Sent: Wednesday, July 26, 2006 12:27 PM
> > > To: 'FreeTDS Development Group'
> > > Subject: [freetds] no-PHP
> > >
> > > So, here is the situation.
> > > I installed all the required libraries. Now I can connect 
> to MSSQL 
> > > server from shell and run all my queries.
> > >
> > > But...When I try to use it through PHP, there is no luck. I don't 
> > > even get an error. It apparently connects to the db 
> server ass well 
> > > but doesn't loop through the result set.
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > > Usman
> > >
> > >
> > > _______________________________________________
> > > FreeTDS mailing list
> > > FreeTDS at lists.ibiblio.org
> > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > >
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS at lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> 



More information about the FreeTDS mailing list