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
reference:qstr [2015/07/19 06:59] – [Usage] mnewnhamv5:reference:connection:qstr [2021/01/25 02:59] (current) mnewnham
Line 2: Line 2:
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 +== See Also ==
 +[[v5:reference:connection:addq|addQ()]]\\
 == Syntax == == Syntax ==
   string qStr(   string qStr(
-         string $unquoted+         string $unquotedText
          )          )
 </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]].
  
 ------------------------------ ------------------------------
Line 17: 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 31: 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.txt · Last modified: 2021/01/25 02:59 by mnewnham