Fork me on GitHub

Calling a library method from a pnadmin.php  Bottom

  • Hi all

    I've wrapped my database transactions in some OO code so that I can call Foo->getAll() to return a collection of module items as an array of objects.

    When I call my getAll() function from a non-module PHP page (first including the class and loading the module), it works as expected. When I call it from inside pnadmin.php, it returns false.

    I thought perhaps that there was something wrong with the getAll() method, so I stepped through it line by line with die() statements. When I do this, it is all working fine: the DB produces the correct data, an array of objects is created, etc. But for some reason when the array is returned, it evaluates to null or false within pnadmin.php, while the same method call produces a working array outside of the module.

    Any ideas?
  • Well, I solved it. The problem was that I was closing the DB connection as well as the record set. In my minimal test, this didn't matter as there were no further transactions, but in the actual module, it was obviously baaaaad.

This list is based on users active over the last 60 minutes.