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.

mysql_num_rows

Empfohlene Antworten

Veröffentlicht

hi,

kann mir mal jemand sagen warum das nicht funktioniert??


$q = mysql_query($query, $conn);

$reihen=mysql_num_rows($q);

er bringt mit

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in http://.... on line 111

ich versteh nicht warum.

in $query steht "SELECT * FROM $conf_pass->db_user_login WHERE nic=$nic"

ich hoffe ihr könnt mir helfen

diese Fehlermeldung hatte ich auch!

ich habs dann so gelöst:

if(@mysql_num_rows($p))

{

$anzahl = mysql_num_rows($p);

}

else

{

$anzahl = 0;

}

so müsste das dann funktionieren!

Die Fehlermeldung "supplied argument is not a valid MySQL result resource" ist meist ein sicheres Indiz dafür, dass die SQL-Abfrage fehlerhaft ist. Dann gibt mysql_query() nämlich keinen "result source" zurück, sondern FALSE.

Wenn man sich einen sauberen Programmierstil angewöhnen würden, käme man da auch von selbst drauf. Kurz gesagt: Rückgabewert von mysql_query() prüfen und bei FALSE mit mysql_error() die Fehlermeldung ausgeben.

Dein Problem liegt in der Zusammensetzung des SQL-Strings, die Variablenzugriffe solltest du ausserhalb der Gänsefüsschen schreiben:

$query = "SELECT * FROM " . $conf_pass->db_user_login . " WHERE nic=" . $nic;

Ist "nic" ein Text- oder Zahlenfeld? Wenn es ein Textfeld ist, gehört der Wert natürlich noch in Hochkomma.

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.