Guest User

Untitled

a guest
Dec 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <?php
  2. include 'bbcode.php';
  3. class Prisijungimas {
  4.  
  5. var $host;
  6. var $username;
  7. var $password;
  8. var $db;
  9.  
  10. function connect(){
  11.  
  12. $con = mysql_connect($this->host, $this->username, $this->password)or die (mysql_error());
  13. mysql_select_db($this->db, $con)or die (mysql_error());
  14. mysql_set_charset('UTF8');
  15.  
  16. }
  17. function BodyGet(){
  18.  
  19. $sql = "SELECT * FROM tvs_content ORDER BY id DESC";
  20. $res = mysql_query($sql)or die (mysql_error());
  21. while($row = mysql_fetch_assoc($res)){
  22. echo '' . $row['body'] . '';
  23. }
  24.  
  25. }
  26. function IdGet(){
  27.  
  28. $sql = "SELECT * FROM tvs_content ORDER BY id DESC";
  29. $res = mysql_query($sql)or die (mysql_error());
  30. while($row = mysql_fetch_assoc($res)){
  31. echo '' . $row['id'] . '';
  32. }
  33.  
  34. }
  35. function TitleGet(){
  36.  
  37. $sql = "SELECT * FROM tvs_content ORDER BY id DESC";
  38. $res = mysql_query($sql)or die (mysql_error());
  39. while($row = mysql_fetch_assoc($res)){
  40. echo '' . $row['title'] . '';
  41. }
  42.  
  43. }
  44. function Gavimas(){
  45.  
  46. $sql = "SELECT * FROM tvs_content ORDER BY id DESC";
  47. $res = mysql_query($sql)or die (mysql_error());
  48. while($row = mysql_fetch_assoc($res)){
  49. echo '<div class="npavadinimas">'. convert_bbcodes( $row['title'] ). '</div>';
  50. echo '<div class="nturinys">'. convert_bbcodes( $row['body'] ). '</div>';
  51. }
  52.  
  53. }
  54. function EilesGavimas(){
  55.  
  56. $sql = "SELECT * FROM tvs_content ORDER BY id DESC";
  57. $res = mysql_query($sql)or die (mysql_error());
  58. while($row = mysql_fetch_assoc($res)){
  59. echo '<span style="color:red">' . $row['id'] . '</span> . <span style="color:black">' . $row['title'] . '</span><br/>';
  60. }
  61.  
  62. }
  63.  
  64. } //Pabaiga
  65.  
  66. $obj = new Prisijungimas();
  67. $obj->host = 'localhost';
  68. $obj->username = 'root';
  69. $obj->password = '';
  70. $obj->db = 'lvlifetvs';
  71. $obj->connect();
  72. $domain = 'localhost';
  73.  
  74. ?>
Add Comment
Please, Sign In to add comment