performance of classes vs. functions for database connections

From: Date: Thu, 05 Feb 2004 20:16:40 +0000
Subject: performance of classes vs. functions for database connections
Groups: php.general 
Request: Send a blank email to php-general+get-176929@lists.php.net to get a copy of this message
i have a function that does authentication of a user, whose user/pass are stored in an md5($var ) fashion. i query these from the mysql db in an authentication (if !$user || !pass) function checking against md5($pass). my thinking is that classes would be better suited to grab object properties, such as variable values, when doing things such as statistical calculations (top 5 most frequented pages/site or number/hits per page) rather than to perform the tasks normal functions could perform. my question is: what is the advantage of making this database function a class other than being able to instantiate it multiple times in the same script. being that i use mysql_pconnect() won't i see a performance hit on the db for successive connections? i would most likely just make a db connection/query class and pass it the auth querystring but would i do better to leave well enough alone with my existing function?

« previous php.general (#176929) next »