Skip to content

Instantly share code, notes, and snippets.

@CharlesCraft50
Created May 1, 2016 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CharlesCraft50/22d56cf3640b78e6cbf68e3ca8772ac7 to your computer and use it in GitHub Desktop.
Save CharlesCraft50/22d56cf3640b78e6cbf68e3ca8772ac7 to your computer and use it in GitHub Desktop.
<?php
include('database.php');
$searchByOrder = $_REQUEST["SubjectNamePostsOrderBy"];
if($searchBy = $conn->prepare("SELECT * FROM PostData WHERE SubjectName LIKE ? ORDER BY " . $searchByOrder . "")) {
$searchLikeBy = "%" . $_REQUEST["SubjectNamePostsLike"] . "%";
$searchBy->bind_param('s', $searchLikeBy);
$searchBy->execute();
$searchBy->bind_result($Id, $UserName, $SubjectName, $PostDataPost, $MainImage, $DatePosted, $PostViews, $UpVoted, $DownVoted);
while($searchBy->fetch()) {
echo "<pre style=\"background-color: #fafafa; border-left: 3px solid #333;\"><a href=\"?SubjectName=" . $SubjectName . "\"><h3>" . $SubjectName . "</h3></a><p style=\"font-size: 13px; display: inline; color: #9197a3;\">User Posted: " . $UserName . " </p><p style=\"font-size: 13px; display: inline; color: #9197a3;\">Date Posted: " . $DatePosted . " </p><div id=\"descArea\"><br>" . $PostDataPost . "</div><br>" . "<img src=\"" . $MainImage . "\" style=\"max-width: 500px; max-height: 500px;\"></img><img src=\"DownVoted-Icon.png\" width=\"30\" height=\"30\"></img> " . $DownVoted . "<br><div style=\"font-size: 13px; display: inline; color: #9197a3;\">Views: " . $PostViews . "</div></pre><p style=\"border: 1px solid transparent; border-bottom: 1px solid black; \"></p>";
}
} else {
echo "Problem Loading Index Post Data! Error: " . $conn->error;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment