ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:param

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
Next revisionBoth sides next revision
v5:reference:param [2016/01/13 02:31] – ↷ Page moved from reference:param to v5:reference:param mnewnhamv5:reference:connection:param [2020/01/24 23:48] – [Description] document param(false) call to reset counter dregad
Line 2: Line 2:
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 +==See Also==
 +[[v5:reference:connection:addq|addQ()]]\\
 == Syntax == == Syntax ==
   string param(   string param(
-         string $name+         string $name
-         optional type='C'+
          )          )
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
 The function param returns a database-specific placeholder for a prepared query statement.  The function param returns a database-specific placeholder for a prepared query statement. 
 +
 +This method is used with [[v5:userguide:learn_bind:bind_vars|bind variable SQL statement execution]], to produce injection resistant code.
 +
 +On RDBMS with positional (numbered) query parameters such as PostgreSQL, calling ''param(false)'' will reset the parameter counter, allowing to start building a new query.
 +
 ------------------------------ ------------------------------
 ===== Usage ===== ===== Usage =====
Line 30: Line 36:
 */ */
 </code> </code>
 +<code php>
 +/*
 +* Connection to Postgres database
 +*/
 +print $db->param('account');
 +/*
 +* prints $1
 +*/
 +</code>
 +
  
v5/reference/connection/param.txt · Last modified: 2021/02/26 01:35 by dregad