Re: Passing arguments as they are received to another function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On the line where you have
self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
try this

call_user_func_array(array(self::$statement,'bindParam'),func_get_args());

see if that works...?


On Sat, Jul 12, 2008 at 5:36 PM, Luigi Perroti <luigi.perroti@xxxxxxxxxxxxxx>
wrote:

> On Sat, Jul 12, 2008 at 6:00 PM, James Dempster wrote:
>
> > You might want to take a look at
> > http://php.net/manual/en/function.call-user-func-array.php
>
>
>
> Thank you very much for your suggestion.
> I've looked into it but I guess this doesn't work with what I'm trying to
> do, although what you suggested should indeed work perfectly with my
> previous example.
> Here's a snippet from the code that I'm having problems with:
>
> class MainDatabase {
>    private static $mainDatabase = NULL;
>    private static $statement = NULL;
>    //...
>    //...
>    //...
>    public static function prepare($query) {
>        self::$mainDatabase->beginTransaction();
>        self::$statement = self::$mainDatabase->prepare($query);
>    }
>    public static function bindParam() {
>
>
> self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
>        // Results in:
>        // PHP Fatal error:  Call to undefined method
> PDOStatement::call_user_func_array() ...
>        // I've also tried with
> call_user_func_array('PDOStatement::fetchAll',func_get_args());
>        // but no luck, same error.
>    }
>    //...
>    //...
>    //...
> }
>
> I thought that a solution for the previous example would work in this
> scenario too, but I guess this isn't the case.
> Any further suggestions would be very welcome, thanks.
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux