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

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:connection:qstr [2016/01/17 00:28] – ↷ Page moved from v5:reference:qstr to v5:reference:connection:qstr mnewnhamv5:reference:connection:qstr [2021/01/25 02:59] (current) mnewnham
Line 3: Line 3:
 <WRAP right box> <WRAP right box>
 == See Also == == See Also ==
-[[reference:addQ()]]\\+[[v5:reference:connection:addq|addQ()]]\\
 == Syntax == == Syntax ==
   string qStr(   string qStr(
-         string $unquoted, +         string $unquotedText
-         optional bool $dontFixQuotes=false+
          )          )
 </WRAP> </WRAP>
Line 14: Line 13:
  
   - Wrapped in single quotes.The value can then be used, for example in an SQL statement.   - 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+  - 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]].
  
 ------------------------------ ------------------------------
Line 23: Line 22:
 $SQL = "SELECT * FROM names WHERE name='$string'"; $SQL = "SELECT * FROM names WHERE name='$string'";
  
-$result = $db->Execute($SQL);+$result = $db->execute($SQL);
  
 /* /*
Line 37: Line 36:
 $SQL = "SELECT * FROM names WHERE name=$qString"; $SQL = "SELECT * FROM names WHERE name=$qString";
  
-$result = $db->Execute($SQL);+$result = $db->execute($SQL);
  
 /* /*
- * Execution Succeeds+ * Execution succeeds
  */  */
 </code> </code>
  
v5/reference/connection/qstr.1452986918.txt.gz · Last modified: 2017/04/21 11:33 (external edit)