Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Błąd Call to a member function prepare() on a non-object, problem z kodem.
casperii
post
Post #1





Grupa: Zarejestrowani
Postów: 681
Pomógł: 28
Dołączył: 14.08.2014

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


Panowie próbuje się zalogować poprzez ajax. Niestety otrzymuje bład w pliku class.php
Fatal error: Call to a member function prepare() on a non-object in line 13 czyli linia gdzie jest:

  1. $sql = $this->db->prepare("SELECT * FROM tabelka WHERE user=:login") or die ($db->errorInfo());


class.php
  1. class xx{
  2. private $db;
  3.  
  4. function __construct($con){
  5. $this->pdo = $con;
  6.  
  7. }
  8. }


Może ktoś podpowiedzieć co robię źle?

Ten post edytował casperii 7.05.2016, 18:20:01
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
CuteOne
post
Post #2





Grupa: Zarejestrowani
Postów: 2 958
Pomógł: 574
Dołączył: 23.09.2008
Skąd: wiesz, że tu jestem?

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


  1. class A {
  2. public function make($dane) {
  3. echo 'a' . $dane;
  4. }
  5. }


  1. include 'A.php';
  2.  
  3. $dane = 'b';
  4. $a = new A();
  5. $a->make($dane);

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: 3.10.2025 - 07:55