ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:qstr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
reference:qstr [2015/07/19 06:59] – created mnewnhamreference:qstr [2016/01/07 04:06] mnewnham
Line 2: Line 2:
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 +== See Also ==
 +[[reference:addQ()]]\\
 == Syntax == == Syntax ==
   string qStr(   string qStr(
-         string $unquoted+         string $unquoted
 +         optional bool $dontFixQuotes=false
          )          )
 </WRAP> </WRAP>
 ==== Description ==== ==== Description ====
-The function ''qStr()'' takes an input string, and allows it to be appropriately quoted to a database-specific standard. If the string itself contains quotes, they are escaped in the correct way. The field can then be used, for example in an SQL statement.+The function ''qStr()'' takes an input string, and allows it to be:
  
 +  - Wrapped in single quotes.The value can then be used, for example in an SQL statement.
 +  - Have quotes inside the string escaped in a way that is appropriate for the database. This is done wherever possible using PHP driver functions e.g. [[http://php.net/manual/en/mysqli.real-escape-string.php|MySQL real_escape_string]]. The second parameter, ''$dontFixQuotes'' stops any internal quoting happening, This parameter was mostly used in older versions of PHP when the now removed ''magic_quotes'' parameter was enabled, and the 2 methods were in conflict. 
 +
 +------------------------------
 ==== Usage ==== ==== Usage ====
 <code php> <code php>
Line 36: Line 43:
  */  */
 </code> </code>
- 
  
v5/reference/connection/qstr.txt · Last modified: 2021/01/25 02:59 by mnewnham