I've created (with help from some code from the site) a function to make
strings or arrays mysql safe. It works just fine, assuming you pass your
variables by reference ( sqlSafe(&$var) ), but I get this error every time
it is used:

[error] PHP Warning:  Call-time pass-by-reference has been deprecated -
argument passed by value;  If you would like to pass it by reference, modify
the declaration of [runtime function name]().  If you would like to enable
call-time pass-by-reference, you can set allow_call_time_pass_reference to
true in your INI file.  However, future versions may not support this any
longer.  in file.php on line X

I want the function to be able to accept as many variables as needed to make
them sqlsafe (10 is enough for now), and to remove that annoying error, I'd
also like to not need to pass them by reference. Is this possible?? and if
so, how?? I know it is possible to add the & before each function parameter,
but then I can't pass more or less variables than I put in the function
definition, cause you can't have default values for a reference parameter
(go figure), and it'll also complain if you give it too few variables.

function sqlSafe( $a0,
  echo "<h1>Too Many Args in sqlSafe</h1>";
  $name="a" . $i;
  if(!isset($$name)) continue;
   foreach($$name as $n => $v){
     ${$name}[$n] = mysql_escape_string ($v);
   $$name = mysql_escape_string ($$name);

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to