Jump to content

A few general PHP & DataBase newbie questions


doug

Recommended Posts

In my PHP database experiments so far, I've been using MySQL. It's all worked fine. I use cPanel at my ISP to create databases, set up the connections in PHP and everything works ok.In the O'Reilly book I've been reading, "Programming PHP 2nd Ed", in the chapter on databases, the author first suggests using the PEAR DB abstraction layer for the purposes of portability.At the end of the chapter, he describes another abstraction layer, PDO (PHP Data Objects) and says it should be available "by the time you read this" and listed some benefits over PEAR DB.What do most PHP programmers do these days? Just make MySQL calls directly? Make use of PEAR DB? Make use of PDO? I know that Ruby on Rails always uses database abstraction layers for maximum portability, and the idea seems like a good one. But what is really done in common practice?Also, the author mentions that SQLite is bundled with PHP. Is there any reason to prefer using that over MySQL?What are you thoughts?Thanks,doug

Link to comment
Share on other sites

I can't speak for MOST PHP programmers, but I'll tell you what I personally do:I use a DB Object which I make Myself. Now there are obviously many ways in which you could do this, one method would be to simply extend the DBA class offered by Pear with whatever methods you may want / need. I build mine from scratch, because i don't really want to use anything other than MySQL, although I should learn the syntax for PgSQL and all that other Jazz, odds are i'll have MySQL on my server, and if not then i get a new host/install it myself.SQLite is a very basic method of SQL Databases, in my opinion of course. Honestly its used mainly for people who's webhosts (for some strange reason...) offer PHP support, but don't offer, or charge more, for MySQL support. SQLite is a very basic system in my opinion, again, with very limited ability. MySQL is much more powerful as a database engine, again, all within the rights of my opinion.That's about as much as I can say for it. Choose your evil honestly is the name of the game.

Link to comment
Share on other sites

For the most part, portability is only useful if you're distributing your script for others to use, although you wouldn't want the database interface to break if MySQL suddenly weren't available. Personally, I use MySQL directly, but I'm mostly a hobbyist for now.By the way, PEAR's DB has been superseded by MDB2.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...