note 86447 added to function.mysql-query
| From: | Anonymous at osu1 dot php dot net | Date: | Sun, 19 Oct 2008 21:22:19 +0000 |
| Subject: | note 86447 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145494@lists.php.net to get a copy of this message | ||
Relying in external functions doesn't help you in learning programming, that is calling
external functions without having an idea of their use.
<?PHP
function mysql_queryf($string)
{
$args = func_get_args();
array_shift($args);
$len = strlen($string);
$sql_query = "";
$args_i = 0;
for($i = 0; $i < $len; $i++)
{
if($string[$i] == "%")
{
$char = $string[$i + 1];
$i++;
switch($char)
{
case "%":
$sql_query .= $char;
break;
case "u":
$sql_query .= "'" . intval($args[$args_i]) . "'";
break;
case "s":
$sql_query .= "'" . mysql_real_escape_string($args[$args_i]) .
"'";
break;
case "x":
$sql_query .= "'" . dechex($args[$args_i]) . "'";
break;
}
if($char != "x")
{
$args_i++;
}
}
else
{
$sql_query .= $string[$i];
}
}
return mysql_query($sql_query);
}
?>
----
Server IP: 80.241.173.254
Probable Submitter: 151.53.35.177
----
Manual Page -- http://www.php.net/manual/en/function.mysql-query.php
Edit -- https://master.php.net/note/edit/86447
Del: integrated -- https://master.php.net/note/delete/86447/integrated
Del: useless -- https://master.php.net/note/delete/86447/useless
Del: bad code -- https://master.php.net/note/delete/86447/bad+code
Del: spam -- https://master.php.net/note/delete/86447/spam
Del: non-english -- https://master.php.net/note/delete/86447/non-english
Del: in docs -- https://master.php.net/note/delete/86447/in+docs
Del: other reasons-- https://master.php.net/note/delete/86447
Reject -- https://master.php.net/note/reject/86447
Search -- https://master.php.net/manage/user-notes.php