I'm trying to learn OOP with php and MySql. I have a table with lot of students (names, e-mail etc.) Do I make one object for each pupil or one large object with all the pupils in it? How to load data from the table and then make many objects at the same time? Can anyone give me som starting help here?
If you're looking for something that makes a database table into an object itself, then I think something like propel http://propel.phpdb.org/trac/ is what you're looking for. This is an ORM framework. With it you can access a database just like you would access a normal php class. Using your example, you would use something like: $student = new studentDB; $student->setId(1); $student->getName(); PHP: to access a student's name, etc.. If you're just trying to use an OOP method of accessing a database, then php has the built-in mysqli database class. http://www.php.net/mysqli