Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "username";
  4. $password = "";
  5. $dbname = "dbname";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $sql = "SELECT comment_txt, name, comment_date FROM mytablename where productcomment_increment_id='$productId' && comment_status='Approved'";
  15. $result = $conn->query($sql);
  16.  
  17. if ($result->num_rows > 0) {
  18. while($row = $result->fetch_assoc()) {
  19. echo "<i><b>Author Name:</b></i>";
  20. echo $row["name"];
  21. echo "<br /><i><b> Comment: </i></b>";
  22. echo $row["comment_txt"];
  23. echo "<br /><i><b>Date: </i></b>";
  24. echo $row["comment_date"];
  25. echo "<br><br>";
  26. }
  27. } else {
  28. //echo "0 results";
  29. }
  30. $conn->close();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement