query( $Query ); $p = array(); while ($row = mysql_fetch_object($Result)) { $q = new Part(); $q->SetRow($row); $p[] = $q; } return( $p ); } function newResultsRow($UserID) { $db = new db(); $Result = $db->query( "Insert into test_results (UserID, Date, Questions) values ($UserID, now(), '')" ); if( $Result ) return $db->insertid(); else return -1; } function getResultsRow($id) { $r = new Results(); $r->buildFromID($id); return $r; } function setResultFor($q, $a, $id) { $r = new Results(); $r->buildFromID($id); $r->setAnswerFor($q, $a); $r->save(); return $r; } function resetTest($id) { $db = new db(); $Result = $db->query( "Update test_results set Questions = '' where id = $id" ); } function getTestsFor($UserID) { $db = new db(); $Result = $db->query( "Select *, UNIX_TIMESTAMP(Date) as d from test_results where UserID = $UserID" ); $ary = array(); while ($row = mysql_fetch_object($Result)) { $r = new Results(); $r->buildFromResult($row); $ary[] = $r; } return $ary; } } $t = new test(); print_r( $t->getQuestions()); ?>