I think you can update this:
$UpdateGoTo = "http://". ($SecurityAssisttbldirectorylistings->getColumnVal("toptable")) . "/hotpage/horse-profile.php?horseid=" ."";
to:
$UpdateGoTo = "http://". ($SecurityAssisttbldirectorylistings->getColumnVal("toptable")) . "/hotpage/horse-profile.php?horseid=[InsertID]";