note 95408 added to function.pg-query-params

From: Date: Fri, 01 Jan 2010 18:45:30 +0000
Subject: note 95408 added to function.pg-query-params
Groups: php.notes 
Request: Send a blank email to php-notes+get-164522@lists.php.net to get a copy of this message
pg_query and pg_query_params can be combined into a single function. This also removes the need to construct a parameter array for pg_query_params: function my_query($conn, $query) { if(func_num_args() == 2) return pg_query($conn, $query); $args = func_get_args(); $params = array_splice($args, 2); return pg_query_params($conn, $query, $params); } Usage: /* non-parameterized example */ my_query($conn, "SELECT $val1 + $val2"); /* parameterized example */ my_query($conn, "SELECT $1 + $2", $val1, $val2); ---- Server IP: 69.147.83.197 Probable Submitter: 75.149.240.149 ---- Manual Page -- http://www.php.net/manual/en/function.pg-query-params.php Edit -- https://master.php.net/note/edit/95408 Del: integrated -- https://master.php.net/note/delete/95408/integrated Del: useless -- https://master.php.net/note/delete/95408/useless Del: bad code -- https://master.php.net/note/delete/95408/bad+code Del: spam -- https://master.php.net/note/delete/95408/spam Del: non-english -- https://master.php.net/note/delete/95408/non-english Del: in docs -- https://master.php.net/note/delete/95408/in+docs Del: other reasons-- https://master.php.net/note/delete/95408 Reject -- https://master.php.net/note/reject/95408 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164522) next »