turning mysql statements into a class (just an idea i have)

From: Date: Fri, 11 Apr 2003 12:26:14 +0000
Subject: turning mysql statements into a class (just an idea i have)
Groups: php.general 
Request: Send a blank email to php-general+get-143486@lists.php.net to get a copy of this message
hi.. was just looking at a few messages about database classes in subject lines and thought it might be easier to come up with a class that i could use that turned statements like mysql statements to get data from tables into a class then just use the class members/methods to actually get the data as i need them instead of typing the same function lines over and over again... say make something like this: clas database { public: //connect to server function connect() { include("conf.inc"); mysql_connect($host, $mysqluser, $mysqlpwd); } function get_company() { $query=mysql_query("select company from members"); } ...... //so on with field info and stuff //and then insert private variables if needed } then use it: $member new database; echo $member->get_company(); and so on down the line for whatever i need... then possibly be able to change the class later or as i go to be able to fit any application i might need to use a db for... let me know if this is a wise choice or am i off the wall a little with this idea... tnx

« previous php.general (#143486) next »