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.

Encoding von Parametern im Formular

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe folgendes Problem. In einer Usertabelle stehen Usernamen. Unter anderem "Ciao" und "Cia_".

Nun habe ich eine Suchfunktion mit der ich über den Usernamen direkt an das Profil des Users komme.

Wenn ich nun aber in diese Suche "Cia_" eingebe lande ich immer im Profil des Users "Ciao".

$username = mysql_escape_string(strtolower($_POST["username"]));

if($username!="")

{

$result__ = @mysql_query("select user, id from NA_user where LOWER(user) ='$username'");

while ($result_ = @mysql_fetch_row($result__))

{

$user_toshow = $result_[0];

$id_towshow = $result_[1];

$found=true;

}

}

Das ist der Code, der mir dann in die Variable "user_toshow" den Namen Ciao reinschreibt.

Was muß ich beachten, damit die Abfrage richtig funktioniert? Der phpMyAdmin kommt ja auch mit der Abfrage klar. Für mich sieht das hier irgendwie nach einem Problem aus, das meine MySQL anfrage hat.

Fehlen noch irgendwelche Einstellungen in meinem System? Ich kann mich nicht erinnern das "_" ein Wildcard o.ä. ist.

Danke für die Hilfe

Fehlen noch irgendwelche Einstellungen in meinem System? Ich kann mich nicht erinnern das "_" ein Wildcard o.ä. ist.

Danke für die Hilfe

Ok, habe es rausgefunden. Bei den MySQL-Abfragen muß ein Unterstrich separat maskiert werden.

Aus der PHP.net doku

Note: mysql_escape_string() does not escape % and _.

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.