db2_escape_string

(PECL ibm_db2 >= 1.6.0)

db2_escape_string Used to escape certain characters

Beschreibung

db2_escape_string(string $string_literal): string

Prepends backslashes to special characters in the string argument.

Parameter-Liste

string_literal

The string that contains special characters that need to be modified. Characters that are prepended with a backslash are \x00, \n, \r, \, ', " and \x1a.

Rückgabewerte

Returns string_literal with the special characters noted above prepended with backslashes.

Beispiele

Beispiel #1 A db2_escape_string() example

Result of using the db2_escape_string() function

<?php

$conn 
db2_connect($database$user$password);

if (
$conn) {
    
$str[0] = "All characters: \x00 , \n , \r , \ , ' , \" , \x1a .";
    
$str[1] = "Backslash (\). Single quote ('). Double quote (\")";
    
$str[2] = "The NULL character \0 must be quoted as well";
    
$str[3] = "Intersting characters: \x1a , \x00 .";
    
$str[4] = "Nothing to quote";
    
$str[5] = 200676;
    
$str[6] = "";

    foreach( 
$str as $string ) {
        echo 
"db2_escape_string: " db2_escape_string($string). "\n";
    }
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

db2_escape_string: All characters: \0 , \n , \r , \\ , \' , \" , \Z .
db2_escape_string: Backslash (\\). Single quote (\'). Double quote (\")
db2_escape_string: The NULL character \0 must be quoted as well
db2_escape_string: Intersting characters: \Z , \0 .
db2_escape_string: Nothing to quote
db2_escape_string: 200676
db2_escape_string:

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Suche nach Best Practices zur Leistungsoptimierung von PHP-Skripten!!

Hallo zusammen, Ich habe an einem Projekt mit einigen komplexen PHP-Skripten gearbeitet und mir sind Leistungsprobleme aufgefallen, insbesondere ...

Geschrieben von Isabellay am 30.05.2025 09:41:02
Forum: PHP Developer Forum
Variable Gültigkeit in Blöcken

That's a sharp observation! You're absolutely right – the core issue isn't where the console.log() is placed, but when it executes relative to w ...

Geschrieben von Bendomenech68 am 30.05.2025 09:28:17
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS
Eingabe in einer Datenbank

Schön, dass du dich mit SQL und PHP beschäftigst. Wenn die Ausgabe aus der Datenbank schon funktioniert, aber die Eingabe nicht, kann es tatsäc ...

Geschrieben von karina am 30.05.2025 09:14:22
Forum: SQL / Datenbanken
Mailversand aus Kontaktformular mit Datei Upload / Technischer Ablauf php / EU-Recht

Regarding the technical process: For most contact forms with file upload, the file is first temporarily stored on the server so it can be attached ...

Geschrieben von lyraellington12 am 30.05.2025 09:08:05
Forum: PHP Developer Forum