PCHomepage
Programmer
In a relatively simple WHILE loop that should show a half dozen or so records, only one is showing and it is appearing twice so there is clearly a typo somewhere but I cannot spot it. Is there an eagle-eye who can help? Thank you!
Code:
function ListRecordings($DBconn) {
$Query = "SELECT r.ID AS RecordingID, r.Format AS FormatID, r.CatalogNo, r.Description, r.Year, r.ArchiveCopy,
r.Bootleg, p.Phonic, fc.Format AS FormatText, fc.FormatOrder AS FormatOrder, c.CountryName AS CountryText,
l.LabelName AS LabelText, fc.Format AS FormatCaptionText, ca.ImageID1 AS ImageID, rt.Title AS Title,
r.PressingHistory
FROM ((((((`conn`.recordings r
LEFT JOIN `conn`.phonic p ON p.ID = r.MonoStereo)
LEFT JOIN `geoip`.countries c ON c.ID = r.Country)
LEFT JOIN `conn`.labels l ON l.LabelID = r.Label)
LEFT JOIN `conn`.formats fc ON fc.ID = r.Format)
LEFT JOIN `conn`.coverart_assignments ca ON ca.RecordingUsed = r.ID)
LEFT JOIN `conn`.recordtitles rt ON rt.ID = r.Title) ";
$Where = " WHERE r.EntryVerified = 1"; // Initializes $Where variable
$Where .= (CCGetParam("OriginalPress","")) ? " AND r.PressingHistory = ".CCGetParam("OriginalPress",""): "";
$Where .= (CCGetParam("Bootleg","")) ? " AND r.Bootleg = ".CCGetParam("Bootleg",""): "";
$Where .= (CCGetParam("Country","")) ? " AND r.Country = ".CCGetParam("Country",""): "";
$Where .= (CCGetParam("Format","")) ? " AND r.Format = ".CCGetParam("Format",""): "";
$Order = (CCGetParam("OriginalPress","") == 2) ?
" ORDER BY fc.FormatOrder, Year":
" ORDER BY fc.FormatOrder, rt.Title, Year";
$Query = $Query . $Where . $Order;
$DBconn->query($Query);
[COLOR=red]while ($DBconn->next_record()) :
$RecordID = $DBconn->f("RecordingID");
$ImageID = $DBconn->f("ImageID");
$FormatID = $DBconn->f("FormatID");
$FormatText = $DBconn->f("FormatText");
$Title = $DBconn->f("Title");
$CatalogNo = $DBconn->f("CatalogNo");
$Description = $DBconn->f("Description");
$Category = (CCGetParam("s_keyword","")) ? DLookup("CategoryName", "lookup_categories", "ID=15", $DBconn): "";
$RecordList = "";
global $last_type; // Show format type caption only once until it changes to the next type
if ($FormatID != $last_type) :
//$RecordList .= "<div class=\"AlbumFormat\">". $FormatText ."s</div>";
$RecordList .= $FormatText . "s<br>\n";
$last_type = $FormatID;
else :
$FormatID = "";
endif;
$RecordList .= "<p>$Title<br>\n";
$Quirk = time().randchr(10);
$Thumbnail = DLookup("Thumbnail", "images_coverart", "ID='" . $ImageID . "'", $DBconn);
if ($ImageID) :
$ImageID = $ImageID;
elseif ($ImageID && !$Thumbnail) :
$ImageID = "104"; // shows Image Coming Soon if there is no thumbnail
else :
$ImageID = "360"; // shows No Image if there is no cover art assignment entry
endif;
$RecordList .= (GetUserID() && GetGroupID() == 4) ?
"<a href=\"/administration/coverart_admin.php?ID=" . $ImageID . "\">":
"<a href=\"/recording_details.php?ID=" . $RecordID . "\">";
$RecordList .= "<img border=\"0\" src=\"/show_image.php?ID=$ImageID&Quirk=$Quirk&Type=2\" align=\"left\" width=\"50\" class=\"ImageLeft\"></a>";
$RecordList .= ($CatalogNo && $CatalogNo != "NA") ? "<font size=\"-1\">catalog no: $CatalogNo</font><br>": "";
$RecordList .= (strlen($Description) > 300) ?
strip_tags(substr_replace($Description, ' . . .', 300)):
$RecordList .= strip_tags($Description);
endif;
endwhile;[/color]
return $RecordList;
}