Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [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
skowron-line
post
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


Cytat(grucha87 @ 18.12.2009, 12:22:58 ) *
probouje zaimportowac na yoyo baze ale wywala mi bład co w niej jest nie tak?:

Moja szklana kula mówi mi że jest to problem na linii krzesło -> klawiatura. Bądź łaskaw i pokaż nam jaki to błąd.


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
grucha87
post
Post #3





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

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


  1. [b]Błąd[/b]
  2. Wygląda na TO, że w twoim zapytaniu SQL jest błąd. W znalezieniu przyczyny problemu może pomóc także - jeśli się pojawi - poniższy opis błędu serwera MySQL.
  3.  
  4. ERROR: Nieznany znak przestankowy @ 1
  5. STR: <?
  6. SQL: <?php
  7. class db
  8. {
  9. Public $guery;<?php
  10. class db
  11. {
  12. Public $guery;<?php
  13. class db

  1. [b]apytanie SQL:[/b] <?php class db { Public $guery;
  2.  
  3. [b]MySQL zwrócił komunikat: [/b][url="http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html"][img]http://mysql1.yoyo.pl/themes/original/img/b_help.png[/img][/url]
  4.  
  5. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
  6. class db
  7. {
  8. Public $guery' at line 1
Go to the top of the page
+Quote Post
piotrekkr
post
Post #4





Grupa: Zarejestrowani
Postów: 386
Pomógł: 25
Dołączył: 28.09.2005

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


Eee wygląda na to że w zapytaniu wysyłasz kod php smile.gif Możliwe że tak miało być ale zapomniałeś użyć mysql_real_escape_string() na dodawanej treści.
Go to the top of the page
+Quote Post
grucha87
post
Post #5





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

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


ale gdzie to mam dodac?
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 21.08.2025 - 09:00