Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

pg query params function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php pg query params () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

pg_query_params -- Execute a query, specifying query variables as separate parameters

Syntax

resource pg_query_params ( string query, array params )

resource pg_query_params ( resource connection, string query, array params )

pg_query_params() works identically to pg_query(), except that instead of putting query parameters directly into the query string, placeholders are used and the parameters are passed in separately. Unlike pg_query(), only one non-empty SQL statement can be executed at a time.

Parameters passed in this way are automatically quoted and escaped if necessary. This is an effective way of improving the security of your scripts and eliminating the need for manual quoting and escaping of parameters.

Placeholders are indicated in the query by $1, $2, $3 and so on. The first parameter will be substituted for $1, the second for $2, the third for $3.

Examples

Example 1. Using pg_query_params()

<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");

// Find all shops named Joe's Widgets.  Note that it is not necessary to
// escape "Joe's Widgets"
$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1', array("Joe's Widgets"));

// Compare against just using pg_query
$str = pg_escape_string("Joe's Widgets");
$result = pg_query($dbconn, "SELECT * FROM shops WHERE name = '{$str}'");

?>

Php pg query params Function syntax tag

pg query params php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php pg query params syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online