glFusion Wiki

Site Tools


glfusion:development:api:sanitize_class:preparefordb

sanitize::prepareForDB

(glFusion SVN)

prepareForDB – Prepare data for DB use

Description

prepareForDB($str)

Escapes special characters in the unescaped string so it is safe to use in a SQL query.

Parameters

str

The data to escape.

Return Value

A string ready for use in a SQL query.

Example

$unescapedString = 'This data has a \ and a " (double quote)';

$escapedString = $inputHandler->prepareForDB($unescapedString);

This would return the following into $escapedString:

This data has a \\ and a \" (double quote)

Notes

See Also

glfusion/development/api/sanitize_class/preparefordb.txt · Last modified: 2017/04/12 21:15 (external edit)

Page Tools