Re: From mysql to mssql...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tristan,

Tristan Pretty wrote:
> However, I've been given a one page project to do, that needs to add the
> contecnt of a form to an mssql database...
>
> I'm fine with doing all the page, apart from talking to mssql... how
> drasitally does this differ from the standard mysql functions tha tI
> use..?
>

The quick answer is that you're in luck: the MSSQL API looks a lot like MySQL's PHP API. For example, mysql_fetch_array() -> mssql_fetch_array().

A practical word of advice, though: use a database abstraction layer. There are a number out there that will make your life easier: PEAR::DB, PEAR::MDB, ADOdb, Creole (PHP5). Most (all?) of these support MS SQL Server and they will all make thing much easier -- especially if you ever decide to try to run that SQL Server app on MySQL. I would recommend MDB (or MDB2) if you are using PHP4; ADOdb is fast, but if you care about source code quality and/or design you'll use PEAR.

One difference you'll probably discover, if you extend your app at all, is that there is no LIMIT in MS SQL Server. To do paged queries is quite difficult -- and that's why using a db abstraction layer will help you out.

Other differences in the SQL / results are quite numerous. Date/time formats look different (some abstraction layers will help with this). MySQL also allows for some pretty sloppy SQL, and MS SQL Server will complain when you try to do things like add aggegate functions to your SELECT() clause without having a GROUP BY clause.

> (Also, I nearly ahd to do it in asp... I'd never used it before, but after
> lookign at it, it made me damned happy that I use PHP.. way more user
> friendly!!)


At the risk of being stoned, I will say that I've had the opportunity to work with ASP.NET/C# and I absolutely love that famework (and the C# language). It's a very well conceived answer to problem of OO n-tier web application development. I love PHP and have been using it for many years, but I also love OO app architecture and even PHP5 really doesn't play in the same league as solutions like ASP.NET. Classic ASP is a different story.

Cheers,
Hans

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux