You should have used the or die to debug. The problem is that you are using single quotes to quote identifier names in the SQL statement. With MySQL, you should use backticks to quote identifier names. You should also cast $annoid to int, or as in my example, use the appropriate format specifier with sprintf:
$query = sprintf("SELECT `oldannoid` FROM `announceedit` where `annoid` = '%d'", $annoid);
$result = mysql_query($query);