Skip to content

Instantly share code, notes, and snippets.

@johnhiott
Last active August 29, 2015 14:02
Show Gist options
  • Save johnhiott/c66986cacc2645eb37f4 to your computer and use it in GitHub Desktop.
Save johnhiott/c66986cacc2645eb37f4 to your computer and use it in GitHub Desktop.
<?php
try {
$db = new PDO("mysql:host=$C9_IP;dbname=$C9_DB", $C9_USER, $C9_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $ex) {
die($ex->getMessage());
}
$tagStmt = $db->prepare("SELECT tag FROM Tag WHERE postid = :postid");
$tagStmt->bindValue(":postid", $row["id"]);
$tagStmt->execute();
while($tagRow = $tagStmt->fetch(PDO::FETCH_ASSOC)) { ?>
<span class="label label-default">
<?php echo $tagRow["tag"] ?>
</span>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment