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.

[PHP] zwei Datenbanken ansprechen?

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich möchte in PHP zwei Datenbanken ansprechen. Mein Code zur Zeit:

($db_* sind gegeben und auch in Ordnung)


$conn=mysql_pconnect($db_server,$db_login, $db_passwd) || die ("Unable to connect to database!");
$_SESSION['prod']=mysql_select_db($db_database,$conn) || die ("Unable to access the database");

$conn2=mysql_pconnect($db_server_b,$db_login_b,$db_passwd_ || die ("Unable to connect to backup-database!");
$_SESSION['backup']=mysql_select_db($dsb_database_b,$conn2) || die ("Unable to access the backup-database");
[/PHP]

Ich möchte also die Verbindungskennungen in den Sessionvariablen 'prod' und 'backup' speichern.

Folgende Fehlermeldung (zweite Zeile):

Warning: Supplied argument is not a valid MySQL-Link resource in /home/www/functions.php on line 97

Kann mir jemand erklären, was ich falsch gemacht habe?

Vielen Dank schon mal :)

welche zeile in deinem script ist die zeile 97?

um die Fehlermeldungen im Falle des Falles zu nutzen, darfst du nicht mit dem "||" operator trennen, sondern musst den "or" operator verwenden!!!

  • Autor
welche zeile in deinem script ist die zeile 97?

in dem Script-Schnipsel die zweite Zeile.

um die Fehlermeldungen im Falle des Falles zu nutzen, darfst du nicht mit dem "||" operator trennen, sondern musst den "or" operator verwenden!!!

hmmm... ist das nicht das gleiche?!? dacht ich immer... :confused:
in dem Script-Schnipsel die zweite Zeile.

hmmm... ist das nicht das gleiche?!? dacht ich immer... :confused:

Und das ist auch genau der Grund, warum $conn kein MySql-Link mehr ist. Denn in diesem Fall kommt ein booleescher Wert raus...

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.