0) { $FindCats = "SELECT catName, catKeywords, catBlurb FROM PhotoCats WHERE catID = ".$catIDfromQstring; $stmt = $conn->prepare($FindCats); $stmt->execute(); $subcatphotos = mysqli_fetch_assoc($stmt->get_result()); if($subcatphotos){ $mainCatName = $subcatphotos['catName']; $mainCatKeywords = $subcatphotos['catKeywords']; $mainCatBlurb = $subcatphotos['catBlurb']; } } // sp_GetPageOfImagesByCategoryNewByPhotoID //this solution gets THREE layers down of cats... enough for most if not all nested cat situations $catIDarr = array(); // first put the overall catID into the array $catIDarr[] = $catIDfromQstring; // get all cats in this parent category $cmdGetCategories = "SELECT catID, catName FROM PhotoCats WHERE catParent = ".$catIDfromQstring." ORDER BY catLevel DESC "; if ($result=mysqli_query($conn,$cmdGetCategories)) { // they have categories selected $hasChildren = 1; // Return the number of rows in result set $totalCountOfCats = mysqli_num_rows($result); //mysqli_data_seek($result,0); // push cat IDs into an array for photo getting select later while($row=mysqli_fetch_array($result)) { $catID = $row['catID']; $catIDarr[] = $catID; $cmdGetCategories2 = "SELECT catID, catName FROM PhotoCats WHERE catParent = ".$catID." ORDER BY catLevel DESC "; if ($result2=mysqli_query($conn,$cmdGetCategories2)) { // they have categories selected // Return the number of rows in result set $totalCountOfCats += mysqli_num_rows($result2); //mysqli_data_seek($result,0); // push cat IDs into an array for photo getting select later while($row2=mysqli_fetch_array($result2)) { $catID2 = $row2['catID']; $catIDarr[] = $catID2; $cmdGetCategories3 = "SELECT catID, catName FROM PhotoCats WHERE catParent = ".$catID2." ORDER BY catLevel DESC "; if ($result3=mysqli_query($conn,$cmdGetCategories3)) { // they have categories selected // Return the number of rows in result set $totalCountOfCats += mysqli_num_rows($result3); //mysqli_data_seek($result,0); // push cat IDs into an array for photo getting select later while($row3=mysqli_fetch_array($result3)) { $catID3 = $row3['catID']; $catIDarr[] = $catID3; } } } } } } $cateString = implode(",", $catIDarr); } if(empty($mainCatName)){ $mainCatName = $catNameFromURL; } $conCatName = ""; if ($contestCatID == 1) { $conCatName = "Nature Photography and Landscapes"; } elseif ($contestCatID == 2) { $conCatName = "Animals and Pet Photography"; } elseif ($contestCatID == 3) { $conCatName = "People and Portraits"; } elseif ($contestCatID == 4) { $conCatName = "Elements of Design - Leading Lines, Patterns..."; } elseif ($contestCatID == 5) { $conCatName = "Techniques and Photoshop Photos"; } elseif ($contestCatID == 6) { $conCatName = "Travel Photography and Places"; } elseif ($contestCatID == 7) { $conCatName = "Flower Photography"; } elseif ($contestCatID == 8) { $conCatName = "Details and Macro Photography"; } elseif ($contestCatID == 9) { $conCatName = "Man-Made Things"; } elseif ($contestCatID == 10) { $conCatName = "Catch-All"; } if(!empty($conCatName)){ $seoTitle = "Photography Gallery: " . $mainCatName . " / " . $conCatName . " - " . $start; $mainCatBlurb = "Stunning photographs that placed in our monthly photo contest."; } else { $seoTitle = "Photography Gallery: " . $mainCatName . " - Page " . $start . "; View Beautiful Images"; } if (strlen($seoTitle) > 65) { $seoTitle = left($seoTitle,62) . "..."; } $seoMetaDescription = $mainCatBlurb . " - " . $start . " Get inspired by these gorgeous " . $conCatName . " photo galleries."; require '../incHeadWithoutRequired.php'; $catName4URL = urlencode($mainCatName); $catName4URL = str_replace("+%26+","-and-",$catName4URL); $courseID = $_GET['courseID'] ?? ''; $camID = $_GET['camID'] ?? 0; if (!is_numeric($camID)) $camID = ""; $Favpt = $_GET['Favpt'] ?? ''; // a string $FavMemID = $_GET['FavMemID'] ?? 0; $mem4gall = $_GET['mem4gall'] ?? 0; $mem4Wins = $_GET['mem4Wins'] ?? 0; $mem4Fins = $_GET['mem4Fins'] ?? 0; $mem4SFs = $_GET['mem4SFs'] ?? 0; $sortBye = $_GET['sortBye'] ?? ''; // by default, show recently categorized first, which is not New (that's new photos) // we are on "see my own winners" page if ($mem4Wins != 0) { if (strtolower($sortBye) == "love") { $sortBye = "Love"; } } if ($catIDfromQstring == 0 && ($Favpt != "EPs" && $Favpt != "myFpics" && $Favpt != "fpics" && $mem4Wins == 0 && $mem4Fins == 0 && $mem4SFs == 0)) { header("Location: /gallery.php"); //galleryTOCDynoSub.php?cat=541 } /* Dim securityBreach For Each securityBreach in Request.QueryString If inStr(Request.QueryString(securityBreach),"DECLARE") > 0 Or inStr(Request.QueryString(securityBreach),"VARCHAR") > 0 Or inStr(Request.QueryString(securityBreach),"EXEC") > 0 Then Response.End End If Next updaterAccess=Request.Querystring("updaterAccess") 'check for session variable If updaterAccess = "" Then updaterAccess = Session("updaterAccess") End if +++++++++ pref 1 and pref 2 use same on page style sheets gallery-content2 and gallery-content1 , right? ALSO ADD THIS BACK IN on photo-show.php Redirect to this same page with the variable changed if change of display does not make this page too complicated */ $galleryContent = "gallery-content2"; $galleryColGrid = "col-md-3"; $photoSize = "m"; // if they got here from links to dynoGall2 but prefer another gallery, handle if (!empty($galleryPreferenceCA1)) { if ($galleryPreferenceCA1 == 2) { // what used to be "-2" 2 across $galleryContent = "gallery-content1"; $galleryColGrid = "col-md-6"; $photoSize = "m"; } elseif ($galleryPreferenceCA1 == 3) { // what used to be "-3" 4 across $galleryContent = "gallery-content"; $galleryColGrid = "col-md-4"; $photoSize = "t"; } } if ($sortBye == "Love") { $sqlOrderBy = "n.photoScore"; // works only when photoScore is in the first part of the SQL SELECT //} elseif $sortBye == "NEWPIX" && $mem4gall = "0") { same as above but NOT personal // NEWEST UPLOADS } elseif ($sortBye == "New") { $sqlOrderBy = "p.photoID";// same as by p.dateCreated // default to MOST RECENTLY CATEGORIZED ++++++++ are we actively adding photos to categories still? NO so I have temporarily changed to sort by photoID } else { // sorting by new categorized, SAME AS $sortBye == "New" ??? $sqlOrderBy = "pcc.photoID"; // sorting by p.dateCreated (turned off now) only works when photoScore is in the first part of the SQL SELECT } $rowsPerPage = (isset($_GET['rowsPerPage']) ? $_GET['rowsPerPage'] : 12); /* MAYBE THIS WAS FOR contestWinners for this month which is done in Entries ? $dateStartContestMonth = date('Y-m-d', strtotime("first day of this month")); $dateEndContestMonth = date('Y-m-d'); */ if ($mem4SFs != 0) { // my own staff favorites sp_GetPageofImagesStaffFavoritesByMemberNEW $cmdGetPhotosCount = "SELECT count(photoID) FROM Photos WHERE memberID = " . $mem4SFs . " AND (contestWinner LIKE '%S') AND post in ('Yes','PVT') "; } elseif ($mem4Fins != 0) { // my own finalists p_GetPageofImagesFinalistsByMemberNEW $cmdGetPhotosCount = "SELECT count(photoID) FROM Photos WHERE memberID = " . $mem4Fins . " AND (contestWinner LIKE '%F') AND post in ('Yes','PVT')"; } elseif ($mem4Wins != 0) { // my own winners sp_GetPageofImagesWinnersByMemberGRAND1st or sp_GetPageofImagesWinnersByMemberMostLOVED // now using view for Favorite most LOVED sort if ($sortBye == "Love") { $cmdGetPhotosCount = "SELECT COUNT(photoID) FROM vw_PhotosWithScore WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%0' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2')"; } else { $cmdGetPhotosCount = "SELECT count(photoID) FROM Photos WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%0' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') AND post in ('Yes','PVT')"; } /* $cmdGetPhotosCount = "SELECT count(photoID) FROM Photos"; if ($sortBye == "Love") { $cmdGetPhotosCount .= "p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } // New sp_GetPageofImagesWinnersByMemberNEW $cmdGetPhotosCount .= " WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%G' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') AND post in ('Yes','PVT') ORDER BY"; if ($sortBye == "G") { $cmdGetPhotosCount .= " contestWinner DESC"; } else { $cmdGetPhotosCount .= " photoID DESC"; } */ } elseif ($Favpt == "fpics" && !empty($FavMemID)) { // Photos You Love $cmdGetPhotosCount = "SELECT COUNT(p.photoID) FROM vw_PhotosWithScore p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID WHERE pf.memberID = " . $FavMemID; /* $cmdGetPhotosCount = "SELECT count(favPhotoID) FROM PhotoFavorites"; if ($sortBye == "Love") { $cmdGetPhotosCount .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotosCount .= " WHERE memberID = " . $FavMemID . " AND post in ('Yes','PVT')"; */ } elseif ($Favpt == "myFpics" && !empty($FavMemID)) { // My Photos OTHERS Love $cmdGetPhotosCount = "SELECT COUNT(photoID) FROM vw_PhotosWithScore WHERE memberID = " . $FavMemID; /* $cmdGetPhotosCount = "SELECT count(DISTINCT photoID) FROM Photos p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID"; if ($sortBye == "Love") { $cmdGetPhotosCount .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotosCount .= " WHERE p.memberID = " . $FavMemID . " AND post in ('Yes','PVT')"; */ } else { // get all photos in all cats +++++++++ THIS IS THE SLOWEST QUERY $cmdGetPhotosCount = "SELECT count(DISTINCT p.photoID) FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID"; if ($sortBye == "Love") { $cmdGetPhotosCount .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotosCount .= " WHERE post in ('Yes','PVT')"; /* if ($sortBye == "Love") { $cmdGetPhotosCount = "SELECT count(DISTINCT p.photoID) FROM PhotoCatsCross pcc JOIN vw_PhotosWithScore p ON pcc.photoID = p.photoID JOIN PhotoCats pc WHERE 1=1 "; } else { $cmdGetPhotosCount = "SELECT count(DISTINCT p.photoID) FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc WHERE post in ('Yes','PVT')"; } */ //if (!empty($cateString)) { // $cmdGetPhotosCount .= " AND pcc.catID IN (".$cateString.")"; //} // in a particular contest sub cat like Nature vs Travel if (!empty($contestCatID)) { $cmdGetPhotosCount .= " AND p.contestCatID = " . $contestCatID; } // a viewer seeing his own pics, if ($mem4gall > 0) { $cmdGetPhotosCount .= " AND p.memberID = " . $mem4gall; } // pics taken with a camera if (!empty($camID)) { $cmdGetPhotosCount .= " AND p.cameraID = " . $camID; } // Editor's picks if ($Favpt === "EPs") { $cmdGetPhotosCount .= " AND p.contestWinner = 'EPEPEP'"; } } //echo "

cmdGetPhotosCount=".$cmdGetPhotosCount; // NEW APRIL 2021 - get counts for only basic categories that are important /* this is TOO complicated. But old way is just too SLOW... have to find a different way to make everything faster $r = mysqli_query($conn, $cmdGetPhotosCount) or die("SQL Error: " . mysqli_error($conn)); $rowC = @mysqli_fetch_array($r, MYSQLI_ASSOC); $tCount = $rowC[0]; MY FINALIST SAID 120, MY WINNERS 120. MY EDITOR PICK 120. EPs as a whole maybe use catString instead and sum up the counts of all */ $q="SELECT count(catID) FROM PhotoCatsImportantList4Counts WHERE catID = " . $catIDfromQstring . " ORDER BY catID"; $rTC = mysqli_query($conn, $q) or die("SQL Error: " . mysqli_error($conn)); $rowrTC = @mysqli_fetch_array($rTC, MYSQLI_ASSOC); $tCountrTC = $rowrTC[0]; // any results if ($tCountrTC > 0) { //echo "

tCountrTC=".$tCountrTC; $q="SELECT lastCount FROM PhotoCats WHERE catID = " . $catIDfromQstring . " "; $dataImpC = mysqli_query($conn, $q); while($impCSet = mysqli_fetch_assoc($dataImpC)) { $tCount = $impCSet['lastCount']; //echo "

tCount=".$tCount; } if ($tCount == 0) { $tCount = 150; // testing } } else { // this cat is not in the important list $tCount = 120; // default } if (isset($_GET['p']) && is_numeric($_GET['p'])) { // if # of pages is already here, passed in via query $pages = $_GET['p']; } else { // Calc # of pages if ($tCount > $rowsPerPage) { // more than 1 page $pages = ceil ($tCount/$rowsPerPage); } else { $pages = 1; } } $rowsOnLastPage = $tCount % $rowsPerPage; if ($mem4SFs != 0) { // my own staff favorites sp_GetPageofImagesStaffFavoritesByMemberNEW $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE memberID = " . $mem4SFs . " AND (contestWinner LIKE '%S') AND post in ('Yes','PVT') ORDER BY photoID DESC LIMIT ?,?"; } elseif ($mem4Fins != 0) { // my own finalists p_GetPageofImagesFinalistsByMemberNEW $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE memberID = " . $mem4Fins . " AND (contestWinner LIKE '%F') AND post in ('Yes','PVT') ORDER BY photoID DESC LIMIT ?,?"; } elseif ($mem4Wins != 0) { // my own winners if ($sortBye == "Love") { $cmdGetPhotos = "SELECT photoID, photoName, photoTitle, memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(dateCreated, '%M %d, %Y') AS dateCreated, contestWinner, photoScore FROM vw_PhotosWithScore WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%0' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') ORDER BY photoScore DESC LIMIT ?,?"; } else {// New sp_GetPageofImagesWinnersByMemberNEW $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%0' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') AND post in ('Yes','PVT') ORDER BY"; if ($sortBye == "G") { $cmdGetPhotos .= " RIGHT(contestWinner,1), contestWinner DESC LIMIT ?,?"; } else { $cmdGetPhotos .= " photoID DESC LIMIT ?,?"; } } /* SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE memberID = 36654 AND (contestWinner LIKE '%0' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') AND post in ('Yes','PVT') ORDER BY RIGHT(contestWinner,1) DESC, contestWinner DESC LIMIT 0,100 SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE RIGHT(contestWinner,1) = '0' AND post in ('Yes','PVT') ORDER BY contestWinner DESC FINDING all previous Grands SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p WHERE RIGHT(contestWinner,1) = 'G' AND post in ('Yes','PVT') ORDER BY contestWinner DESC $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner"; if ($sortBye == "Love") { $cmdGetPhotos .= ", n.photoScore"; } $cmdGetPhotos .= " FROM Photos p"; if ($sortBye == "Love") { $cmdGetPhotos .= "p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } // New sp_GetPageofImagesWinnersByMemberNEW $cmdGetPhotos .= " WHERE memberID = " . $mem4Wins . " AND (contestWinner LIKE '%G' OR contestWinner LIKE '%1' OR contestWinner LIKE '%2') AND post in ('Yes','PVT') ORDER BY"; if ($sortBye == "G") { $cmdGetPhotos .= " contestWinner DESC LIMIT ?,?"; } else { $cmdGetPhotos .= " photoID DESC LIMIT ?,?"; } */ } elseif ($Favpt == "fpics" && !empty($FavMemID)) { // Photos You Love if ($sortBye == "Love") { $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner, photoScore FROM vw_PhotosWithScore p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID WHERE pf.memberID = " . $FavMemID . " ORDER BY photoScore DESC LIMIT ?,?"; } else { $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM vw_PhotosWithScore p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID WHERE pf.memberID = " . $FavMemID . " ORDER BY dateCreated DESC LIMIT ?,?"; } /* SELECT count(DISTINCT p.photoID) FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID WHERE post in ('Yes','PVT') $cmdGetPhotos = "SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner "; if ($sortBye == "Love") { $cmdGetPhotos .= ", n.photoScore"; } $cmdGetPhotos .= " FROM Photos p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID"; if ($sortBye == "Love") { $cmdGetPhotos .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotos .= " WHERE memberID = " . $FavMemID . " AND post in ('Yes','PVT') ORDER BY dateCreated DESC LIMIT ?,?"; */ } elseif ($Favpt == "myFpics" && !empty($FavMemID)) { // My Photos OTHERS Love $cmdGetPhotos = "SELECT DISTINCT photoID, photoName, photoTitle, memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(dateCreated, '%M %d, %Y') AS dateCreated, contestWinner, photoScore FROM vw_PhotosWithScore WHERE memberID = " . $FavMemID; if ($sortBye == "Love") { $cmdGetPhotos .= " ORDER BY photoScore DESC LIMIT ?,?"; } else { $cmdGetPhotos .= " ORDER BY photoID DESC LIMIT ?,?"; } /* $cmdGetPhotos = "SELECT DISTINCT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner"; if ($sortBye == "Love") { $cmdGetPhotos .= ", n.photoScore"; } $cmdGetPhotos .= " FROM Photos p JOIN PhotoFavorites pf ON p.photoID = pf.favPhotoID"; if ($sortBye == "Love") { $cmdGetPhotos .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotos .= " WHERE p.memberID = " . $FavMemID . " AND post in ('Yes','PVT') ORDER BY "; */ /* NOT WORKING shows too many, prob because photoscore is in subquery if ($sortBye == "Love") { $cmdGetPhotos .= "photoScore DESC, "; } */ } else { // get all photos in all cats /* if ($sortBye == "Love") { $cmdGetPhotos = "SELECT DISTINCT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner, photoScore FROM PhotoCatsCross pcc JOIN vw_PhotosWithScore p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID WHERE 1=1"; } else { $cmdGetPhotos = "SELECT DISTINCT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID WHERE post in ('Yes','PVT')"; } */ $cmdGetPhotos = "SELECT DISTINCT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner"; if ($sortBye == "Love") { $cmdGetPhotos .= ", n.photoScore"; } $cmdGetPhotos .= " FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID"; if ($sortBye == "Love") { $cmdGetPhotos .= " LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID"; } $cmdGetPhotos .= " WHERE post in ('Yes','PVT')"; if ($cateString > 0) { $cmdGetPhotos .= " AND pcc.catID IN (".$cateString.")"; } // in a particular contest sub cat like Nature vs Travel if (!empty($contestCatID)) { $cmdGetPhotos .= " AND p.contestCatID = " . $contestCatID; } // a viewer seeing his own pics, if ($mem4gall > 0) { $cmdGetPhotos .= " AND p.memberID = " . $mem4gall; } // pics taken with a camera if (!empty($camID)) { $cmdGetPhotos .= " AND p.cameraID = " . $camID; } // Editor's picks if ($Favpt === "EPs") { $cmdGetPhotos .= " AND contestWinner = 'EPEPEP'"; } $cmdGetPhotos .= " ORDER BY ".$sqlOrderBy." DESC LIMIT ?,?"; } //took pc.catID, out of the selected items in second hALF of querries //echo "

start=".$start; //echo "

rowsPerPage=".$rowsPerPage; //echo "

cmdGetPhotos=".$cmdGetPhotos; var_dump($mysqli->connect_error); $stmt = $conn->prepare($cmdGetPhotos); $stmt->bind_param('ii', $start, $rowsPerPage); $stmt->execute(); $result2 = $stmt->get_result(); /* cmdGetPhotosCount=SELECT count(DISTINCT p.photoID) FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID WHERE post in ('Yes','PVT') AND pcc.catID IN (556) tCount=10833 cmdGetPhotos=SELECT DISTINCT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner, n.photoScore FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID LEFT OUTER JOIN (SELECT favPhotoID, COUNT(favPhotoID) as photoScore FROM PhotoFavorites GROUP BY favPhotoID) n ON p.photoID = n.favPhotoID WHERE post in ('Yes','PVT') AND pcc.catID IN (556) ORDER BY n.photoScore DESC LIMIT ?,? EPs cmdGetPhotosCount=SELECT count(p.photoID) FROM PhotoCatsCross pcc JOIN Photos p ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID WHERE post in ('Yes','PVT') AND p.memberID = 50248 AND contestWinner = 'EPEPEP' ORDER BY pcc.dateCreated DESC cmdGetPhotos=SELECT p.photoID, photoName, photoTitle, p.memberID, directory, threadID, inputID, discussThreadID, DATE_FORMAT(p.dateCreated, '%M %d, %Y') AS dateCreated, contestWinner FROM Photos p JOIN PhotoCatsCross pcc ON pcc.photoID = p.photoID JOIN PhotoCats pc ON pcc.catID = pc.catID WHERE post in ('Yes','PVT') AND p.memberID = 50248 AND contestWinner = 'EPEPEP' ORDER BY pcc.dateCreated DESC LIMIT ?,? // don't use anymore??? If camID != "" Then Dim cmdGetCameraNameByID, brandName, nameOfCam, paramCam, cameraInfo set cmdGetCameraNameByID = Server.CreateObject("ADODB.Command") cmdGetCameraNameByID.ActiveConnection = conn cmdGetCameraNameByID.CommandType = 4 cmdGetCameraNameByID.CommandTimeout = 30 cmdGetCameraNameByID.CommandText = "sp_GetCameraNameByID" Set paramCam = cmdGetCameraNameByID.CreateParameter ("cameraID", 3, 1, , CInt(camID)) cmdGetCameraNameByID.Parameters.Append (paramCam) Set cameraInfo = cmdGetCameraNameByID.Execute if not cameraInfo.eof then brandName = cameraInfo(1) nameOfCam = cameraInfo(2) nameOfCam = brandName & " " & nameOfCam End if End if end if */ // and maybe change the breadcrumb below so I can easily move the spillover into the hamburger menu when they're on mobile /* YES around $totalCountOfCats make 3 be a variable, say then use that to determine layout and conditionally fill in that variable */ $nonHamburgerMenuLimit = 3; ?>

9) { $pageRangePrefix = left($pageID,(strlen(strval($pageID))-1)); /* echo "

start".$start; echo "

pageRangePrefix".$pageRangePrefix; echo "
tCount=".$tCount; echo "
upperLimitPage=".$pages; */ } else { // page 1-9 $pageRangePrefix = 0; } // skipToPageNumber is what is displayed in the long list of numbers // for first iteration of skipToPageNumber, used when it it 10 or above (20, 30...) $skipToPageNumber = strval($pageRangePrefix) . "0"; // finalSkipToPage is shown before Prev and Next links $finalSkipToPage = ($tCount / $rowsPerPage); //i.e 55.9666 or 3 or 3.0833333333333 //echo "
pre=".$finalSkipToPage; if (is_numeric($finalSkipToPage)) { if ($tCount % $rowsPerPage != 0) { //i.e. 55.966 make it 55.966 + 1 = 56.966 3.0833333333333 = 4.0833333333333 $finalSkipToPage = $finalSkipToPage + 1; //echo "
mod0=".$finalSkipToPage; } $finalSkipToPage = Floor($finalSkipToPage); //make 56.966 = 56 ; make 3 = 3 make 4.0833333333333 = 4 //echo "
postRound=".$finalSkipToPage; if ($finalSkipToPage < 10) { $finalSkipToPage = "0" . $finalSkipToPage; //echo "
lessthan10=".$finalSkipToPage; } } ?>

\n\n"; } } // while images ?>

close(); require '../incFootSansModal.php'; ?>