You still did not answer what $id is.
$SQL1 ="SELECT * FROM Depreciation Where EntryID = '$id'";
Also whatever the variable is, I'd say it's a good bet EntryID is NOT some kind of string datatype (varchar or text), but very likely INT UNSIGNED, which means you should be passing it an integer, not a numeric string (i.e. drop the single quotes).
$id is not defined anywhere in the code you shown, but looking at the code you've written, I would go on to assume that EntryID really isn't a column set as primary key or unique index, even though conventionally you'd never name a column somethingID unless a uniqueness constraint is enforced on that column.
Also, if it was unique, there'd be no reason to loop through the result set, since it will have 0 or 1 rows
if ($row1 = mysql_fetch_assoc())
And if it was unique, you really should now what row you are talking about anyway, thus making
if ($AccID[$year] == $DepAccID[$year])
pointless.
Another thing that you should get into the habit of doing is to specify each and every single column you want to select rather than specifying *, even those times you want to select every column from a table. There are several reasons. If you look in half a year, there is a good chance you won't remember exactly what columns are in the table, and if you don't need all of them you are wasting the server's memory and also complicate things even more for yourself since you'd have to figure out what columns are actually used.
Since the two tables are related by the columns AccPeriod.AccID and Depreciation.AccID, you really should retrieve all this information with one query
SELECT a.AccID, AccOpen, AccClose, DepRate
FROM AccPeriod AS a
LEFT JOIN Depreciation AS d ON a.AccID = d.AccID
In my opinion you should also stick to lower case identifiers, especially if you are on a windows machine, since identifiers in MySQL on Windows are case insensitive. Should you have a case mismatch in your PHP strings and later switch to a non-windows OS, you will get errors.
Anyway, now that you have all data retrieved in one query, which is more efficient, it's also easier to handle it. Just loop over the result - each row contains data which is related, so there will be no further comparisons etc.
The LEFT JOIN means that if there is no related data in Depreciation for a given row in AccPeriod, this row from AccPeriod will still be retrieved and if any columns from the join table (Depreciation) are selected these will be set to null. Thus you may
echo ($row['DepRate'] == null ? 0 : $row['DepRate']);