Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <a href="#"><button onclick="#" style="#">Like</button></a>
  2.  
  3. <?php
  4. $dbhost = 'localhost';
  5. $dbuser = 'root';
  6. $dbpass = '';
  7. $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  8. if(! $conn )
  9. {
  10. die('Could not connect: ' . mysql_error());
  11. }
  12. $currentID = mysql_real_escape_string($_GET['id']);
  13. $sql="SELECT comment, userCreated, threadsID FROM comments WHERE threadsID=".$currentID;
  14. #Where my likes column in my DB is
  15. $likes = "SELECT likes WHERE threadsID=".$currentID;
  16. $numrows = mysql_num_rows($sql);
  17. mysql_select_db('comments');
  18. $retval = mysql_query( $sql, $conn );
  19. if(! $retval )
  20. {
  21. die('Could not get data: ' . mysql_error());
  22. }
  23. while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
  24. {
  25. $userCreated = $row['userCreated'];
  26. $comment = $row['comment'];
  27. echo "<div class='comment'>$userCreated:<br>$comment</div><br>";
  28. #echo $userCreated." said<br>".$comment."<br>";
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement