Example #1
0
if ($artistCount > $PREVIEW_COUNT) {
    $random = mt_rand(0, $artistCount - $PREVIEW_COUNT);
} else {
    $random = 0;
}
$artistQuery = "SELECT * FROM " . getJoinTable("artist_list", "artist_artwork_list") . " \n    WHERE " . getJoinMatch("artist_list", "artist_artwork_list", "artist_id") . " AND " . getImageType($IMAGE_SIZE1) . " LIMIT " . $random . ", " . $PREVIEW_COUNT;
$artistResult = $dbHandle->query($artistQuery);
//
$albumCountResult = $dbHandle->query("SELECT * FROM album_list");
$albumCount = $albumCountResult->num_rows;
if ($albumCount > $PREVIEW_COUNT) {
    $random = mt_rand(0, $albumCount - $PREVIEW_COUNT);
} else {
    $random = 0;
}
$albumQuery = "SELECT * FROM " . getJoinTable("album_list", "album_artwork_list") . " \n    WHERE " . getJoinMatch("album_list", "album_artwork_list", "album_id") . " AND " . getImageType($IMAGE_SIZE1) . " LIMIT " . $random . ", " . $PREVIEW_COUNT;
$albumResult = $dbHandle->query($albumQuery);
//
$trackCountResult = $dbHandle->query("SELECT * FROM track_list");
$trackCount = $trackCountResult->num_rows;
if ($trackCount > $PREVIEW_COUNT) {
    $random = mt_rand(0, $trackCount - $PREVIEW_COUNT);
} else {
    $random = 0;
}
$trackQuery = "SELECT * FROM track_list LIMIT " . $random . ", " . $PREVIEW_COUNT;
$trackResult = $dbHandle->query($trackQuery);
//
?>

<a id="topofpage"></a>
Example #2
0
include 'header.php';
// Checks if the artist name has been submitted
if (!($artistName = getReqArtist())) {
    $noInput = true;
} else {
    $noInput = false;
}
// Gets the artist info //
if (!$noInput) {
    $artistInfo = getSingleRow($dbHandle, "artist_list", "artist_name", $artistName);
    $artResult = $dbHandle->query("SELECT * FROM artist_artwork_list WHERE artist_id='" . $artistInfo['artist_id'] . "' AND image_size='" . $IMAGE_SIZE5 . "'");
    $artReturn = $artResult->fetch_array(MYSQLI_BOTH);
}
// Constructs the query to get both album info and artwork //
$albumQuery = "SELECT * FROM " . getJoinTable("album_list", "album_artwork_list") . " \n    WHERE " . getJoinMatch("album_list", "album_artwork_list", "album_id") . " \n        AND " . getImageType($IMAGE_SIZE3) . " \n            AND " . getSectionCriteria("album_title");
if (!$noInput) {
    $albumQuery .= " AND album_list.artist_id='" . $artistInfo['artist_id'] . "'";
}
$albumQuery .= " " . getSortCriteria("album_title");
// Gets the number of albums //
$totalResult = $dbHandle->query($albumQuery);
$totalCount = $totalResult->num_rows;
mysqli_free_result($totalResult);
$albumQuery .= " " . getPageCriteria($totalCount, $MAX_ITEMS_PER_PAGE, true);
$albumResult = $dbHandle->query($albumQuery);
?>

<a id="topofpage"></a>

<div id="content">