$recordset2 needs to be placed inside the loop like so for your code to work
<?php
$wa_startindex = 0;
while(!$Recordset1->atEnd()) {
$wa_startindex = $Recordset1->Index;
?>
<?php
$Recordset2 = new WA_MySQLi_RS("Recordset2",$connsqli,0);
$Recordset2->setQuery("SELECT * FROM photos WHERE photos.photos_category = ?");
$Recordset2->bindParam("s", "".($Recordset1->getColumnVal("category_name")) ."", "-1"); //var1
$Recordset2->execute();
?>
<span class="category"><?php echo($Recordset1->getColumnVal("category_name")); ?></span><br />
<br />
<?php
$wa_startindex = 0;
while(!$Recordset2->atEnd()) {
$wa_startindex = $Recordset2->Index;
?>
<div align="center"><a href="photos/<?php echo($Recordset2->getColumnVal('photos_file')); ?>" rel="lightbox" title="<?php echo($Recordset2->getColumnVal("photos_alt")); ?>"><img src="photos/<?php echo($Recordset2->getColumnVal("photos_file")); ?>" /></a></div>
<?php
$Recordset2->moveNext();
}
$Recordset2->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
<?php
$Recordset1->moveNext();
}
$Recordset1->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>