Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL]problem z sql
grucha87
post
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 31.01.2008

Ostrzeżenie: (0%)
-----


probouje zaimportowac na yoyo baze ale wywala mi bład co w niej jest nie tak?:
  1. <?php
  2. class error
  3. {
  4. Public $type;
  5. Public $text;
  6.  
  7. function printme()
  8. {
  9. echo $this -> text;
  10. }
  11. }
  12.  
  13. class db
  14. {
  15. Public $guery;
  16. Public $output;
  17. Public $connected;
  18. public $conected;
  19. private static $instance;
  20.  
  21. private function __construct()
  22. {
  23. include ('config/db.php');
  24. if(mysql_connect($host, $dbuser, $dbpass))
  25. {
  26. $this -> connected = "true";
  27. mysql_select_db($dbname);
  28. // mysql_query('SET NAMES "utf8"');
  29. }
  30. else
  31. {
  32. $err = new error();
  33. $err -> text = "Nie uda�o si� po��czy� z baz�";
  34. $err -> printme();
  35. }
  36. }
  37.  
  38. public static function getInstance()
  39. {
  40. if(empty(self::$instance))
  41. self::$instance = new db();
  42. return self::$instance;
  43. }
  44.  
  45. function getRow($query)
  46. {
  47. $result = mysql_query($query);
  48. $row = mysql_fetch_assoc($result);
  49. $this -> output = $row;
  50. return $this -> output;
  51. }
  52.  
  53. function getValue($query,$value)
  54. {
  55. $result = mysql_query($query);
  56. $row = mysql_fetch_assoc($result);
  57. $this -> output = $row["$value"];
  58. return $this -> output;
  59. }
  60.  
  61. function getAll($query)
  62. {
  63. $result = mysql_query($query);
  64. $i = 0;
  65. while ($row = mysql_fetch_assoc($result))
  66. {
  67. $arr[$i] = $row;
  68. $i++;
  69. }
  70. $this -> output = $arr;
  71. return $this -> output;
  72. }
  73.  
  74. function count($query)
  75. {
  76. $result = mysql_query($query);
  77. $i = 0;
  78. while ($row = mysql_fetch_assoc($result))
  79. {
  80. $i++;
  81. }
  82. $this -> output = $i;
  83. return $this -> output;
  84. }
  85.  
  86. function send($query)
  87. {
  88. mysql_query($query);
  89. }
  90.  
  91. function test()
  92. {
  93. echo $this -> conected;
  94. }
  95. }
  96. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 20:03