looking at the code for the insert:
<?php
if (isset($_POST["formADDGALLERYBTN"]) || isset($_POST["formADDGALLERYBTN_x"])) {
$InsertQuery = new WA_MySQLi_Query($SMTmysqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "SMTgallery";
$InsertQuery->bindColumn("SMTgallerycat", "i", "".((isset($_POST["SMTgallerycat"]))?$_POST["SMTgallerycat"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMTgalleryimg", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."", "SMTgalleryimg"]["name"]) :"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMTgalleryimgtitle", "s", "".((isset($_POST["SMTgalleryimgtitle"]))?$_POST["SMTgalleryimgtitle"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("NEWGALLERYID");
$InsertQuery->execute();
$InsertGoTo = "add-gallery-confirm.php";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
it is saving to a session named NEWGALLERYID
$InsertQuery->saveInSession("NEWGALLERYID");
not GALLERYIMAGEID