note 38638 added to function.mysql-query

From: Date: Wed, 31 Dec 2003 08:08:37 +0000
Subject: note 38638 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-62707@lists.php.net to get a copy of this message
<? function mysql_queryf() { if (func_num_args() < 1) return; $args = func_get_args(); $fmt = preg_replace("/(%\w)/", '"$1"', array_shift($args), count($args)); foreach (array_keys($args) as $index) $args[$index] = mysql_escape_string($args[$index]); $query = vsprintf($fmt, $args); return mysql_query($query); } ?> mysql_queryf("select * from a where name=%s and age=%d", "Mike", 24); ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38638 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38638&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38638&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62707) next »