Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd w kodzie (OOP)
-h0h-
post
Post #1





Goście







Co zrobiłem źle w tym kodzie ?
  1. <?php
  2. class sLogin{
  3. var $dbConnection;
  4. function dbConnect_mysql($dbConnection){
  5. $dbConnection = explode(&#092;".\", $dbConnection);
  6. mysql_connect($this->$dbConnection[0], $dbConnection[1], $dbConnection[2]);
  7. mysql_select_db($this->$dbConnection[3]);
  8.  }
  9.  }
  10. class sQuery{
  11. var $sql; 
  12.  function DOsQuery($m_query){ 
  13.  if (isset($m_query)) {
  14.  $this->sql = $m_query;
  15.  mysql_query($this->sql); 
  16.  }
  17.  } 
  18.  }
  19.  
  20.  
  21. class sResult{
  22. function return_result(){
  23. $polacz = new sLogin;
  24. $polacz->dbConnect_mysql(&#092;"localhost.root.krasnal.php\");
  25. $zapytanie = new sQuery;
  26. $result = $zapytanie->DOsQuery(&#092;"SELECT * FROM TABELA\");
  27. while ($line = mysql_fetch_array($result)){
  28. echo $line[pole];
  29. }
  30. }
  31.  }
  32. $test = new sResult;
  33. $test->return_result();
  34. ?>

Wyświtla mi:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\usr\apache\httpd\html\site\db.php on line 27
Nie wybrano żadnej bazy danych
Go to the top of the page
+Quote Post

Posty w temacie


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: 20.08.2025 - 00:01