You definitely need to have the anchor tag as Jason suggested, but I believe you also need to tell the lightbox js that it should parse it by adding some sort of class attribute to the a tag.
For example, any of the photo albums on this page photos.php, when you enter an album, the context I use looks like this:
<a href="/user_albums/<?php echo $row_photos['albumID']; ?>/<?php echo $row_photos['image']; ?>" class="lightbox" title="<?php echo (htmlentities($row_photos['name'])); ?>"><img border="0" src="<?php echo $objDynamicThumb1->Execute(); ?>" alt="<?php echo $row_photos['name']; ?>" /></a>
Note the class is denoted as "lightbox". I almost positive that you will have to include that. I noticed in your code that you had the "rel" attribute denoted as lightbox, but I believe it should be class.