Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Probleme mit PDO Klasse

Empfohlene Antworten

Hallo Community,

ich weiß leider keinen Rat mehr und hoffe nun auf eure Hilfe. Und zwar bin ich nun seit heute morgen dabei mich zu der Thematik Datenbankabstraktion unter PHP einzulesen. Leider kommt es bei folgendem Skript zu einem Laufzeitfehler bei Apache mein lokaler Webserver macht die Biege.

Ich sollte vll dazu sagen ich benutz VISTA x64 -.-" Vll gibts irgendwelche Erfahrungswerte.

Mit bestem Gruß

PS. Der Fehler tritt sowohl bei FETCH_CLASS als auch bei allen anderen Alternativen. (assoc,num,both..etc)

<?php

class Kontakt

{

public $user = "";

public $pw = "";

public function __construct()

{

echo $this->user.":".$this->pw;

}

}

$dsn = "mysql:host=localhost;dbname=testdatenbank";

try

{

$db = new PDO($dsn, 'root', '');

}

catch (PDOException $p)

{

echo "Es konnte keine Verbindung hergestellt werden.";

}

$ergebnis = $db->query("SELECT user,pw FROM login");

$ergebnis->setFetchMode(PDO::FETCH_CLASS,"Kontakt",array());

$row = $ergebnis->fetch();

?>

Dickes Merci. Jetzt funktionierts. Wünsch dir frohe Ostern :P

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.