UserByID($id); return $u; } function authUser($em, $pass) { $u = new User(); $u->UserByEmail($em, $pass); return $u; } function createUser($Email, $FirstName, $LastName, $Password, $School, $Preference) { $user = new User(); $user->Email = $Email; $user->FirstName = $FirstName; $user->LastName = $LastName; $user->Password = $Password; $user->School = $School; $user->Preference = $Preference; return $user->insert(); } function updateUser($id, $Email, $FirstName, $LastName, $Password, $School, $Preference) { $user = new User(); $user->id = $id; $user->Email = $Email; $user->FirstName = $FirstName; $user->LastName = $LastName; $user->Password = $Password; $user->School = $School; $user->Preference = $Preference; return $user->update(); } function deleteCareer($userid, $careerid) { $db = new db(); $db->query( "Delete from user_saved_careers where userid = '$userid' and careerid = '$careerid'" ); return $this->getSavedCareers($userid); } function getSavedCareers($userid) { $db = new db(); $Result = $db->query( "Select * from user_saved_careers where userid = '$userid' order by date" ); $ar = array(); while($row = mysql_fetch_object($Result)) { $ar[] = $row->careerid; } return $ar; } function saveCareer($userid, $careerid) { $db = new db(); $Result = $db->query( "Select * from user_saved_careers where userid = '$userid' and careerid = '$careerid'" ); if($row = mysql_fetch_object($Result)) { } else $Result = $db->query( "Insert into user_saved_careers (userid, careerid, date) values ('$userid', '$careerid', NOW())" ); return $this->getSavedCareers($userid); } function deleteSchool($userid, $schoolid) { $db = new db(); $db->query( "Delete from user_saved_schools where userid = '$userid' and schoolid = '$schoolid'" ); return $this->getSavedSchools($userid); } function getSavedSchools($userid) { $db = new db(); $Result = $db->query( "Select * from user_saved_schools where userid = '$userid' order by date" ); $ar = array(); while($row = mysql_fetch_object($Result)) { $ar[] = $row->schoolid; } return $ar; } function saveSchool($userid, $schoolid) { $db = new db(); $Result = $db->query( "Select * from user_saved_schools where userid = '$userid' and schoolid = '$schoolid'" ); if($row = mysql_fetch_object($Result)) { } else $Result = $db->query( "Insert into user_saved_schools (userid, schoolid, date) values ('$userid', '$schoolid', NOW())" ); return $this->getSavedSchools($userid); } } ?>