function LastInsertID(&$db,$fieldname)
	{
		if ($db->hasInsertID) {
			$val = $db->Insert_ID($this->_table,$fieldname);
		}
		else {
			$val = false;
		}

		if (is_null($val) || $val === false) {
			// this might not work reliably in multi-user environment
			return $db->GetOne("select max(".$fieldname.") from ".$this->_table);
		}
		return $val;
	}