v5:reference:connection:addq
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v5:reference:connection:addq [2017/04/21 11:50] – external edit 127.0.0.1 | v5:reference:connection:addq [2017/05/17 19:06] – [Usage] mnewnham | ||
---|---|---|---|
Line 12: | Line 12: | ||
==== Description ==== | ==== Description ==== | ||
The function '' | The function '' | ||
+ | |||
+ | This method is particularly useful when used with [[v5: | ||
------------------------------ | ------------------------------ | ||
Line 40: | Line 42: | ||
*/ | */ | ||
</ | </ | ||
+ | ==== Using qStr With Bind ==== | ||
+ | This example shows a completely database independent bind variable statement with special character escaping, providing strong resistance to SQL injection. | ||
+ | <code php> | ||
+ | $p1 = $db-> | ||
+ | $p2 = $db-> | ||
+ | |||
+ | /* | ||
+ | * Provide internal escaping of ' characters | ||
+ | */ | ||
+ | $qStringField = $db-> | ||
+ | $bind = array(' | ||
+ | ' | ||
+ | |||
+ | $SQL = " | ||
+ | FROM some_table | ||
+ | WHERE integer_field=$p1 | ||
+ | AND string_field=$p2"; | ||
+ | |||
+ | $result = $db-> | ||
+ | </ |
v5/reference/connection/addq.txt · Last modified: 2021/01/25 03:00 by mnewnham