function loadSheets($BookId) { $sql = "select SheetId from ".table('sheets'). " where BookId=$BookId" ; $result = mysql_query($sql); if (!$result) { $error = new GsError(302,"Error loading book."); if($error->isDebugging()){ $err = str_replace("'", '"', mysql_error()); $error->addContentElement("BookId",$BookId); $error->addContentElement("MySql Error",$err); } throw $error; } while ($row = mysql_fetch_object($result)){ $sheet = new Sheet(); $sheet->load($row->SheetId); $this->addSheet($sheet); } }