ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:addq

This is an old revision of the document!


addQ

See Also

qStr

Syntax
string addQ(
       string $unquoted,
       optional bool $dontFixQuotes=false
       )

Description

The function addQ() takes an input string, and applies database specific string quoting. Unlike the method qstr, no pre or post quoting is applied.


Usage

$string = "Patrick O'Reilly";
 
$SQL = "SELECT * FROM names WHERE name='$string'";
 
$result = $db->Execute($SQL);
 
/*
 * Execution fails  due to mismatched ` characters
*/
 
$qString = $db->addQ($string);
 
/*
 * function returns Patrick O\'Reilly (The resulting string is database-specific)
*/
 
$SQL = "SELECT * FROM names WHERE name='$qString'";
 
$result = $db->Execute($SQL);
 
/*
 * Execution Succeeds
 */
v5/reference/connection/addq.1459899458.txt.gz · Last modified: 2017/04/21 11:37 (external edit)