Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SQL] Problem z PDO
pawel.s
post 29.10.2008, 13:16:56
Post #1





Grupa: Zarejestrowani
Postów: 69
Pomógł: 2
Dołączył: 15.08.2007
Skąd: trojmiasto

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


  1. <?php
  2. witajcie moj problem to
  3.  
  4. $dsn = 'mysql:dbname=test;host=127.0.0.1';
  5. $user = 'root';
  6. $password = 'root';
  7.  
  8. try {
  9.    $dbh = new PDO($dsn, $user, $password);
  10. } catch (PDOException $e) {
  11.    echo 'Connection failed: ' . $e->getMessage();
  12. }
  13.  
  14. $result = $dbh->prepare("SELECT * FROM users");
  15. $result->execute();
  16.  
  17. to mam
  18. Fatal error: Call to a member function execute() on a non-object in /var/www/test.php on line 14
  19.  
  20. prosze o pomoc
  21. ?>
Go to the top of the page
+Quote Post
vokiel
post 29.10.2008, 13:47:26
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


  1. <?php
  2. // moze tak:
  3. $dbh->prepare("SELECT * FROM users");
  4. $result = $dbh->execute();
  5. ?>


--------------------
Go to the top of the page
+Quote Post
pawel.s
post 29.10.2008, 14:19:04
Post #3





Grupa: Zarejestrowani
Postów: 69
Pomógł: 2
Dołączył: 15.08.2007
Skąd: trojmiasto

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


dzieki to chyba byl problem
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 Wersja Lo-Fi Aktualny czas: 23.06.2025 - 07:15