Skip to Content.
Sympa Menu

freetds - [freetds] Re: Problem with using the mysql_num_rows and mysql_fetch_array

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Daniel Fazekas <fdsubs AT t-online.hu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Re: Problem with using the mysql_num_rows and mysql_fetch_array
  • Date: Mon, 30 May 2005 03:18:48 +0200


On May 29, 2005, at 22:40, max wrote:

I am running a local Fedora Core 3 box with FreeTDS / PHP and Apache. I
have successfully set up, configured FreeTDS, PHP (with graphic support)
and Apache (with PHP support) using the book SAM PHP, MySQL and Apache
book (sadly slightly out of date - as it references PHP4 instead of
PHP5).

That looks like a bit of a confusion.
You just have to make up your mind on what kind of database server do you want to use. :-)

MySQL and MSSQL are two totally different things.

a) MySQL
It's the free, GPL-licensed and open source database server from MySQL AB in Sweden.
The server runs on a wide variety of platforms, including just about all flavors of UNIX and also on Windows.
See http://www.mysql.com/

In PHP, you use the mysql extension to access it, with function names starting with mysql_


b) MSSQL aka Microsoft SQL Server
Closed source and expensive database server from Microsoft.
The server itself only runs on Windows.
See http://www.microsoft.com/sql/evaluation/overview/default.mspx

In PHP, you use the mssql extension to access it, with function names starting with mssql_

This is what you need FreeTDS for. If you're trying to talk to a Microsoft SQL server running on a Windows machine from another computer which is *not* running Windows, you need FreeTDS and you are - mostly - in the right place.

In essence, I want to assume a couple of things - FreeTDS translates
mysql_fetch_array() and mysql_num_rows() when looking up information in
the database.

FreeTDS has absolutely nothing to do with those mysql_ functions. Just switch them to mssql_ and things should work -- looking at the list of functions you are trying to use, I think only mysql_error won't have a direct mssql_error equivalent.

I did have a look at the API's on the FreeTDS site, but
was slightly confused over what I should be using.

Having successfully installed FreeTDS for use with PHP, the FreeTDS manual should be quite unnecessary for you now. You even appear to have successfully connected to the database.

Going from there, it's the PHP Manual and its pages describing the MSSQL extension you should be reading:

http://www.php.net/mssql

--
fds




Archive powered by MHonArc 2.6.24.

Top of Page