Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <style>
  2. .boxed {
  3. border: 5px solid blue;
  4. margin-left:30px; /* half of width */
  5. margin-top:10px; /* half of height */
  6. /*top:50%;
  7. left:50%; */
  8. height: 120px;
  9. width: 200px;
  10. border-style: double;
  11. /*text-overflow: hidden; */
  12. text-overflow: ellipsis;
  13. float:left;
  14. }
  15. .boxed:hover{
  16. height: 150px;
  17. width: 250px;
  18. -moz-box-shadow: 0 0 10px #ccc;
  19. -webkit-box-shadow: 0 0 20px #ccc;
  20. box-shadow: 0 0 20px #888888;
  21. border-style: double;
  22. /*text-overflow: hidden;*/
  23. text-overflow: ellipsis;
  24. }
  25. </style>
  26.  
  27. <?php
  28. $dbhost = 'localhost';
  29. $dbuser = 'root';
  30. $dbpass = '';
  31. $selection = "ORDER BY id ASC";
  32. $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  33. if(! $conn )
  34. {
  35. die('Could not connect: ' . mysql_error());
  36. }
  37.  
  38. $selection=isset($_GET['sort']) ? $_GET['sort'] : "";
  39. if($selection == "1"){$selection="ORDER BY id DESC";}
  40. else if($selection == "2"){$selection="ORDER BY id ASC";}
  41.  
  42.  
  43. $sql="SELECT id, threadName, message FROM threads ";
  44. $sql.=$selection;
  45.  
  46. mysql_select_db('threads');
  47. $retval = mysql_query( $sql, $conn );
  48. if(! $retval )
  49. {
  50. die('Could not get data: ' . mysql_error());
  51. }
  52. while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
  53. {
  54. $id = $row['id'];
  55. $threadName = $row['threadName'];
  56. $message = $row['message'];
  57. echo "<div class='boxed'><center>".$threadName."<br>".$message."</center></div>";
  58. }
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement