Skip to content

Instantly share code, notes, and snippets.

@CharlesCraft50
Created May 1, 2016 14:20
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/c6be67fd136388d7c15375a5cf2e0d9e to your computer and use it in GitHub Desktop.
Save CharlesCraft50/c6be67fd136388d7c15375a5cf2e0d9e to your computer and use it in GitHub Desktop.
if($PostUpVotes = $conn->prepare("SELECT * FROM PostVotes WHERE SubjectName = ? AND VoteType = 'UpVoted'")) {
$PostUpVotes->bind_param('s', $SubjectNamePost);
$PostUpVotes->execute();
$PostUpVotes->store_result();
$postUpVResult = $PostUpVotes->num_rows();
echo "<script>$(\"#UpVoteThis\").html(\"" . "<img src=\\\"UpVoted-Icon.png\\\" width=\\\"30\\\" height=\\\"30\\\"></img> " . $postUpVResult . "" . "\");</script>";
} else {
echo "<pre>Error UpVoting, Error: " . $conn->error . "</pre>";
}
if($PostDownVotes = $conn->prepare("SELECT * FROM PostVotes WHERE SubjectName = ? AND VoteType = 'DownVoted'")) {
$PostDownVotes->bind_param('s', $SubjectNamePost);
$PostDownVotes->execute();
$PostDownVotes->store_result();
$postDownVResult = $PostDownVotes->num_rows();
echo "<script>$(\"#DownVoteThis\").html(\"" . "<img src=\\\"DownVoted-Icon.png\\\" width=\\\"30\\\" height=\\\"30\\\"></img> " . $postDownVResult . "" . "\");</script>";
} else {
echo "<pre>Error DownVoting, Error: " . $conn->error . "</pre>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment