best way to execute SQL?
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
Theirs NO best way, its what way suits your needs, programming requirements, style, etc.
Another way of putting it is its your choice.
most libraries for PHP are written in C.
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.
thank you for your advise. I guess I'll then stick to what I have been using for now.
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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)