Sunday, May 30, 2010

PHP and PostgreSQL

PHP and PostgreSQLBy Vikram Vaswani This article copyright Melonfire 2000−2002. All rights reserved. Table of Contents A Matter Of Choice............................................................................................................................................1 Getting Started....................................................................................................................................................2 First Steps............................................................................................................................................................5 Digging Deeper....................................................................................................................................................8 Different Strokes...............................................................................................................................................10 Rolling Around..................................................................................................................................................14 Catching Mistakes.............................................................................................................................................16 A Well−Formed Idea........................................................................................................................................18 Surfing The Web...............................................................................................................................................20 PHP and PostgreSQL i A Matter Of Choice There's something patently unfair going on here. For some reason, almost every PHP tutorial on the planet makes the implicit assumption that if you're using PHP with a database, that database is going to be MySQL. Now, I have absolutely nothing against MySQL − I think it's a great product, and I use it fairly often in my development activities. However, it's not the only good open−source RDBMS out there − most developers have been playing with PostgreSQL for quite a while now, and quite a few of them would love to integrate their PostgreSQL backend with PHP. The only problem is, they have no idea

where to start − the functions used to communicate with a PostgreSQL database are different from those used in a MySQL environment, and the documentation out there could do with some updating. Well, it's time to bring some balance back to the universe. Which is why this article looks at PHP from the PostgreSQL developer's point of view, explaining how PHP can be used with the PostgreSQL database system. If you're a MySQL user, you probably don't need to know any of this; if you're a PostgreSQL fan, on the other hand, you can breathe a sigh of relief and flip the page. A Matter Of Choice 1 Getting Started Before we get started, you need to make sure that you have everything you need to successfully use PHP with PostgreSQL. Here's your cheat sheet: 1. The latest version of PostgreSQL, available from http://www.postgresql.org (this article uses version 7.1) 2. A Web server which supports PHP, available from http://www.php.net/ (this article uses Apache 1.3.24 with PHP 4.2.0) Note that your PHP build must support PostgreSQL in order for the examples in this article to work correctly. You can include PostgreSQL support in your PHP build by adding the "−−with−pgsql" configuration...

Website: library.forda-mof.org | Filesize: 58kb
No of Page(s): 22
Download PHP and PostgreSQL.pdf

No comments:

Post a Comment