Hi people,
I want a class that allows create objects that get the information
consulting the DB. So, I am thinking to do something like this:
class element {
public __construct($id,$type = 'id') {
switch($type) {
case 'id':
$where = sprintf(" id = %d ",$id);
break;
case 'name':
$where = sprintf(" name = %s ",escape($id));
break;
//...
// get the row and call setName($row['name'])...
}
}
}
This works fine, but also I want a good way (efficient) of getting a
collection of these objects. I can't figure a convenient way. A static
function its a good posibility? I have some ideas but they imply public
setters of the class `element'.
Thanks for any help.
--
Emilio Astarita <[EMAIL PROTECTED]>
Gnus
http://gnus.org/
<http://www.gnu.org/philosophy/free-sw.html>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php