I am creating a database connection object, and I'm not sure what the best way would be ...
If I create a dbqnation class which establishes the connection (using mysql_connect) I can call mysql_query again in the main script?
What is the inside of the other classes? Do I need to pass the object or attribute as a parameter?
Actually, I'm looking at the best way to connect to the database (using the speed + memory reference) by using a simple class ...
I have my own Constructor has posted for database connection class:
function __construct ($ database = "") {if (! (Empty ($ database)) {$ this-> db = $ Database;} $ this-> dblink = mysql_connect ($ this- & gt; host, $ this- & gt; username, $ this- & gt; password); if (! This-> Dublin) { // fatal error} mysql_select_db ($ this-> db, $ this- & g T; dblink);
}
your own database Rather than creating an abstract class, I would recommend giving a try. The author made an excellent job of using it very easy to get the data structure obtained by the class, is more flexible than the results returned by mysql_query Will save a lot of work.
Comments
Post a Comment