Question: I have a table called c33062 that displays data rows in a page. I have twenty other MySQL tables with the same structure and information, just different data. Instead of creating a page for each, I'd like to create hyperlinks for each that then calls that links table information.
My statement is:

```
$query = "SELECT id, year, price_avg_sold, price_sqft, 
          pct_list_sold, adom, sold_nu, sold_chg, 
          year_1, year_2, year_3, year_4, year_5, 
          year_6, year_7, year_8, year_9, year_10 
          FROM c33062";

```

So in essence, I'd like to make hyperlinks for each table, c33063, c33064, c33065 etc that when clicked, would call that particular table's data into the template page.

What would be the correct way to hyperlink the FROM table?

Answer: 
Suppose you have 10 elements in an array:

```
array = [a, b, c, d, e, f, g, h, i, j]

```

You then loop over the array like this:

```
for (int i = 0; i < array.Size; i++)
{
    array.Remove(i);   
}

```

Then this is what happens step by step:

**step 0**

Remove element 0.
Result: `[b, c, d, e, f, g, h, i, j]`

**step 1**

Remove element 1.
Result: `[b, d, e, f, g, h, i, j]`

**step 2**

Remove element 2.
Result: `[b, d, f, g, h, i, j]`

**step 3**

Remove element 3.
Result: `[b, d, f, h, i, j]`

**step 4**

Remove element 4.
Result: `[b, d, f, h, j]`

**step 5**

Remove element 5. There is no element 5, so there's nothing to remove. Result: `[b, d, f, h, j]`

**step 6 to 9**

Remove element 6 to 9. There is no element 6 to 9, so there's nothing to remove. Result: `[b, d, f, h, j]`

Although my array only counts 10 elements whereas yours counts 128, the principle is the same: you aren't removing all the annotations due to a logical error in your code. Another type of array would throw an array out of bounds exception, but `PdfArray` doesn't do that because to be more tolerant towards faulty PDFs with incomplete arrays.

You could fix your code like this:

```
int n = annotArray.Size;
for (int i = 0; i < n; i++)
{
    annotArray.Remove(0);   
}

```

Or, as you found out yourself, you can remove all annotations at once:

```
pdfReader.RemoveAnnotations();

```
Disclaimer: I haven't used itextSharp. I was curious why it shouldn't remove.Code looks okay though. I googled and found something that might be of your interest. Hope it help.

> 
> You cannot delete the annotations "in place" with
>  iTextSharp. You have to create a new PDF based on the original, and the way
>  to do this is to open the original with PDFReader, use RemoveAt to get rid
>  of the undesirable annotations in memory, then use PDFstamper or PDFcopy to
>  make a new PDF based on what's left.
> 
> 
> 

[Remove Annotation from PDF](http://itextsharp-questions.narkive.com/xZd2BnHq/re-move-stamp-annotations-from-pdf)

[Remove Annotation using PDF Object Number](http://itextsharp.10939.n7.nabble.com/Remove-Annotation-using-PDF-Object-Number-td2831.html) 

[Remove hyperlinks from a PDF document (iTextSharp)](https://stackoverflow.com/questions/5871906/remove-hyperlinks-from-a-pdf-document-itextsharp)

[How do I remove link annotations from a PDF using iText?](https://stackoverflow.com/questions/18974031/how-do-i-remove-link-annotations-from-a-pdf-using-itext)