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 MYSQL Problem

Empfohlene Antworten

Veröffentlicht

Hi,

ich verbinde mich mit einer MYSQL Datenbank und es will einfach nicht hinhauen:

$r1= mysql_query ('SELECT * FROM testschrauben where Nummer = "Z908988"')  or die( 'Fehler in Abfrage: '. mysql_error() );


		while( $row= mysql_fetch_array( $r1 ) ) 

		{


                  $Benennung = $row->Benennung;

	     $Geometrie = $row->Durchmesser;

                  $Laenge = $row->Lange;

	     $Festigkeit = $row->Festigkeitsklasse;

	     $Oberflache = $row->Oberflache;

	     $Nummer = $row->Nummer;


echo $Benennung;

		}

Wo steckt der Fehler? Das Programm läuft durch, ohne eine Fehlermeldung...

Kennst du den Unterschied zwischen Array-Notation und Objekt-Notation?

Füge mal testweise in der Schleife ein

echo "<br/>"

und zähle wie oft es vorkommt!

Bearbeitet von etreu
Tippfehler

mysql_fetch_array liefert dir ein Array zurück, auf das musst du mit $arr['feldname'] oder $arr[$feldindex] zugreifen. Du versuchst gerade es wie ein Object zu verwenden.

$r1= mysql_query ('SELECT * FROM testschrauben where Nummer = "Z908988"') or die( 'Fehler in Abfrage: '. mysql_error() );

while( $row= mysql_fetch_array( $r1 ) )

{

$Benennung = $row['Benennung'];

$Geometrie = $row['Durchmesser'];

$Laenge = $row['Lange'];

$Festigkeit = $row['Festigkeitsklasse'];

$Oberflache = $row['Oberflache'];

$Nummer = $row['Nummer'];

echo $Benennung;

}

Hier noch ein Link falls du dich schlau machen willst:

http://de.php.net/mysql_fetch_array

MfG

Bearbeitet von EckY

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.