$id=$_REQUEST['dogid'];
if(isset($id)){
$output='';
$sql = sprintf("
SELECT callname, regname
FROM tbldogs
WHERE dog_id=%d",
(int)$id);
$rset=$modx->db->query($sql);
if ($modx->db->getRecordCount($rset) > 0) {
while ($row = $modx->db->getRow($rset)) {
$params['callname']=$row['callname'];
$params['regname']=$row['regname'];
$output.=$modx->parseChunk('Gallery', $params, '[+', '+]');
}
}
$sql = sprintf("SELECT filelocation, description
FROM `tblimages`
WHERE use_pict = 'N'
AND dogFK=%d",
(int)$id);
$pic=$modx->db->query($sql);
if($modx->db->getRecordCount($pic) > 0) {
while($row=$modx->db->getRow($pic)){
$params['pic']='<img src="assets/'.$row['filelocation'].'" alt="'.$row['description'].'"/>';
$output.=$modx->parseChunk('Gallery', $params, '[+', '+]');
}
}
$pd = sprintf("SELECT filelocation, file_description description FROM tblpedigree WHERE dogID=%d", (int)$id);
$ped=$modx->db->query($pd);
if($modx->db->getRecordCount($ped) >0){
while($row=$modx->db->getRow($ped)){
$params['pedigree']='<img src="assets/'.$row['filelocation'].'" alt="'.$row['description'].'"/>';
$output.=$modx->parseChunk('Gallery', $params, '[+','+]');
}
}
return $output;
}
Is my snippet, I am not sure why my pictures and name come out but the pedigree information is not I must be doing something really stupid because I can’t seem to find it... Can you guys/gals have a look and let me know where I’ve fat fingured my code?
Specifically
$pd = sprintf("SELECT filelocation, file_description description FROM tblpedigree WHERE dogID=%d", (int)$id);
$ped=$modx->db->query($pd);
if($modx->db->getRecordCount($ped) >0){
while($row=$modx->db->getRow($ped)){
$params['pedigree']='<img src="assets/'.$row['filelocation'].'" alt="'.$row['description'].'"/>';
$output.=$modx->parseChunk('Gallery', $params, '[+','+]');
}
}
return $output; That is where I think i’ve screwed it up...
And I’m not sure why but my page shows the dogs name more than once per picture.
http://modx.chrys-haefen.com/index.php?id=32&dogid=129 I would Really like it if some one could shed some light on this as well.
Thanks for the help.