Skip to content

Instantly share code, notes, and snippets.

@GoodChancer
Created March 28, 2017 03:18
Show Gist options
  • Save GoodChancer/bd088b165622576e515dc4903cf4a6fb to your computer and use it in GitHub Desktop.
Save GoodChancer/bd088b165622576e515dc4903cf4a6fb to your computer and use it in GitHub Desktop.
<?php
/* Get Styles */
$stmt = $pdo->prepare('SELECT style_id FROM album_style WHERE album_id = ?');
$stmt->execute([$albumCurrent['id']]);
$styles = $stmt->fetchAll(PDO::FETCH_COLUMN);
echo '<ul class="styles">';
if (is_array($styles)) {
foreach($styles as $styleID){
$stmt = $pdo->prepare('SELECT name FROM style WHERE id = ?');
$stmt->execute([$styleID]);
$style = $stmt->fetchColumn();
echo '<li>'.$style.'</li>';
}
}else {
echo '<li><i>No styles listed.</i></li>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment