Search DaTutorials:  
HOME
Php Tutorials
Articles
Basics
Date and Time
File Manipulations
Forms
Functions
General
Interactivity
MySql
Navigation
News,Shoutboxes and Blogs
Language Structure and Data Types
Searching
Security
String Manipulation
User Information and Stats
Search For a Tutorial
Php Reference

dbx_escape_string

(PHP 4 >= 4.3.0, PHP 5)

dbx_escape_string --  Escape a string so it can safely be used in an sql-statement.

Description

string dbx_escape_string ( object link_identifier, string text)

dbx_escape_string() returns the text, escaped where necessary (such as quotes, backslashes etc). It returns NULL on error.

Example 1. dbx_escape_string() example

<?php
$link 
= dbx_connect(DBX_MYSQL, "localhost", "db", "username", "password")
   or die(
"Could not connect");

$text = dbx_escape_string($link, "It\'s quoted and backslashed (\\).");
$result = dbx_query($link, "insert into tbl (txt) values ('" . $text . "')");
if (
$result == 0) {
   echo
dbx_error($link);
}
dbx_close($link);
?>

See also dbx_query().



Copyright © 2001-2004 The PHP Group
All rights reserved.

     Crew Insurance | Secured Loans | Intel Dual Core | MPAA | Debt Consolidation
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp