Created
April 15, 2015 13:41
-
-
Save Michales/8263decb165747f2905b to your computer and use it in GitHub Desktop.
show
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/// stránkování | |
$stranka=isset($_GET['stranka']) ? (int)$_GET['stranka'] : 1; | |
$limit=5; | |
$start=($stranka -1)*$limit; | |
// /stránkování | |
$albs=Array(); | |
$pocetAlb=0; | |
If(isset($_GET['interpret'])) { | |
$where="WHERE Contentgroup='".mysql_real_escape_string($_GET['interpret'])."'"; | |
$interpretQ='&interpret='.RawUrlEncode($_GET['interpret']); | |
} | |
Else { | |
$where=''; | |
$interpretQ=''; | |
} | |
$q=MySQL_Query($sql="SELECT (SELECT COUNT(Album) FROM (SELECT * FROM zahranicni $where GROUP BY Album ) p) AS pocet,Album FROM zahranicni $where GROUP BY Album ORDER BY Year,Album LIMIT $start,$limit ") or die(mysql_error()); | |
//echo $sql; | |
While($r=MySQL_Fetch_Assoc($q)) { | |
$albs[]=mysql_real_escape_string($r['Album']); | |
$pocetAlb=$r['pocet']; | |
} | |
$where=Str_Replace('WHERE','AND',$where); // přepsání where pro vyhledávání alb interpreta | |
$query = "SELECT Title,Artist,Album,Track,Year,Length,Composer,Filename,Albumartist,Genre,Contentgroup,Publisher,Web,id,heslo FROM zahranicni WHERE Album IN('".(Implode("','",$albs))."') {$where} ORDER BY FIELD(Album,'".(Implode("','",$albs))."'),Album ASC,Track ASC"; | |
$results = mysql_query($query) or die(Mysql_error()); | |
$aktAlbum=''; | |
$i=0; | |
$a=0; | |
While($result=MySQL_Fetch_Assoc($results)) { | |
$lastResult=$result; // uchová poslední výsledek v proměnné (pro výpis Vydavatele u posledního alba) | |
If($aktAlbum!=$result['Album']) { | |
If($aktAlbum!='') { | |
$a++; | |
?> | |
<div class="oddelovac"> </div> | |
<?php } ?> | |
<h3 style="color:#D2691E;" onclick="hideshow(<?=$a?>)"><?php echo htmlSpecialChars($result['Album'],ENT_QUOTES); ?></h3> | |
<div class="prvok"> | |
<img width="100" height="100" src="<?php echo '/' . rawurlencode($_GET['interpret']) . '/' . rawurlencode($result['Album']) . '.jpg'; ?>" alt="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" title="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" /> | |
<img class="logo" title="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" src="img/logo1.png"></div> | |
<h4><?php echo htmlSpecialChars($result['Albumartist'],ENT_QUOTES); ?></h4> | |
<h4><?php echo htmlSpecialChars($result['Year'],ENT_QUOTES); ?></h4> | |
<h4><a href="details_f.php?interpret=<?php echo rawurlencode($_GET['interpret'])?>&album=<?php echo rawurlencode($result['Album']) ?>">>>>>Details<<<<</a></h4> | |
<br><br> | |
<?php | |
$aktAlbum=$result['Album']; | |
$i=0; | |
} | |
$i++; | |
} | |
?> | |
<div class="oddelovac"> </div> | |
<br> | |
<div id="strankovani"> | |
<?php | |
echo "<a ".($stranka==1?"class=\"nelze\"":"href=\"?stranka=".($stranka-1)."{$interpretQ}\"").">Předchozí </a>"; | |
for($s=1;$s<=Ceil($pocetAlb/$limit);$s++) | |
echo "<a ".($s==$stranka?"class=\"aktualniStrana\"":"href=\"?stranka={$s}{$interpretQ}\"").">$s</a> "; | |
echo "<a ".($stranka==($s-1)?"class=\"nelze\"":"href=\"?stranka=".($stranka+1)."{$interpretQ}\"").">Následující</a>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment