On Fri, Jul 2, 2010 at 11:49 AM, Jakob Günther <MACguell@xxxxxx> wrote: > > I did not find a solution, so i tried passing a array with references. > > $arr = array(&$a, &$b); > bind_param("ii", $arr); > > function bind_param($types, $arr){ > array_unshift($arr, $types); > call_user_func_array (array ($stmt, 'bind_param'), $arr); > } > > This worked in a test-case in one file. But if i call the bind-param-method > from another class it did not work. Do you have any suggestions on this? > > > Am 02.07.2010 17:25, schrieb Jakob Günther: > > Hi, > > > > i'm writing a custom wrapper for the mysqli_stmt class. I have to > > override the method mysqli_stmt::bind_param. This function uses > > "variable-length argument lists". In my function i want to delegate its > > arguments to the original function. > > > > My first naiv implementation was that: > > > > function bind_param($types) { > > $sParams=array(); > > $first=true; > > for($i=1; i < func_num_args(); $i++) { > > $sParams[] = func_get_arg($i); > > } > > > > array_unshift ($sParams ,$types); > > call_user_func_array (array ($this->mysqli_stmt, 'bind_param'), > > $sParams); > > } > > > > But this is not working, because I need to pass it by reference. Is > > there a way to retrieve references to a variable number of arguments? > > > > Thx, Jakob > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Hi Jakob, Try looking at this page: http://www.php.net/manual/en/mysqli-stmt.bind-param.php Specifically, search for a comment by 'gregg at mochabomb dot com', in which Gregg presents a simple wrapper class and deals with the referencing issue the same way you did, by setting array values by reference. I point this out as perhaps seeing the code will give you a clue as to why your code had issues in your second test. If you want help figuring out what's causing trouble, try posting some of the other code (at least the class and instance vars, connection method, and the query method(s)) contained within the class. Adam P.S. Sorry for the duplicate reply, Jakob, I forgot to reply to the entire list the first time :( -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com