I've read several php books and I've run across multiple ways of executing SQL for a MySQL database. What should I use? Do I have to use PEAR? Is PEAR better just because its written in C? Why do you not close a mysql_pconnect connection?
I guess I'm completely confused. please someone tell me the best code
path to follow would be dependent on your overall development style. most, if not all, companies want object oriented development, and in this case if you are going to be using MySQL, you should use the MySQLi API with a MySQL server > 4.1.
If you develop in a object oriented way, I would recommend a completely separate layer for database access, and have other items access that only. Will using a pconnect improve your site? probably not. it's more costly.
Another consideration is portability, in that the mysqli_* functions are only available in PHP5. Therefore, if your software needs to be compatible with PHP4, then you'll need to stick with the mysql_* functions.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks