professional-php-05-class.studentFactory.php / php
<?php class StudentFactory { public static function getStudent(sql = "SELECT * from \"student\" WHERE \"studentid\" = data = sql); //pseudo code. Assume it returns an //array containing all rows returned //by the query. if(is_array(data)) { return new Student(data[0]['name']); } else { throw new Exception("Student id, sql = "SELECT \"course\".\"courseid\", \"course\".\"coursecode\", \"course\".\"name\" FROM \"course\", \"studentcourse\" WHERE \"course\".\"id\" = \"studentcourse\".\"courseid\" AND \"studentcourse\".\"studentid\" = data = sql); //same pseudo code in getStudent() if(is_array(data)) { foreach(datum) { datum['courseid'], datum['name']); objCourse,
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.