Skip to content

Instantly share code, notes, and snippets.

@CharlesCraft50
Created April 19, 2016 15:28
Show Gist options
  • Save CharlesCraft50/3502a4e9d8fb441c4a91dbbe5b304f0a to your computer and use it in GitHub Desktop.
Save CharlesCraft50/3502a4e9d8fb441c4a91dbbe5b304f0a to your computer and use it in GitHub Desktop.
<?php
include('database.php');
$getCmts = $conn->prepare("SELECT * FROM PostComments WHERE SubjecName = ? ORDER BY DatePosted DESC LIMIT ?");
$SName = $_GET['SubjecName'];
$CLimit = $_GET['cmtsLimit'];
$getCmts->bind_param('si', $SName, $CLimit);
$getCmts->execute();
$getCmts->bind_result($Id, $Name, $Comment, $DatePosted);
while($getCmts->fetch()) {
echo "<pre style=\"background-color: #fafafa; padding: 0px;\">";
echo "<p name=\"" . $Id . "\">Id: " . $Id . " User: <b>" . $Name . "</b>" . " Comment Date: " . $DatePosted . "</p>";
echo $Comment;
echo "<a name=\"" . $Id . "\"></a>";
echo "</pre>";
}
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment