MyBB Community Forums
MyBB API fetch all fileNames from my table in my MyBB database. - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: MyBB API fetch all fileNames from my table in my MyBB database. (/thread-189808.html)



MyBB API fetch all fileNames from my table in my MyBB database. - NotWhoYouThinkItIs - 2016-03-13

I'm working on a desktop to call my MyBB API and fetch all the files names from my MyBB database. How ever, I've ran into a corner and I am not sure how to solve my problem. this is my PHP code:


        $sql = "SELECT filename FROM `files`";
        $query = $db->query($sql);

        //$query = $db->simple_select("files", "filename");
        //$files = $db->fetch_array($query);

        if(!$files['filename']) {
            return 0;
        } else {
            return $encryptionEngine->init($files['filename'],"encrypt");
        }

and the errors message: 

Fatal error: Call to a member function query() on null in ..... on line 86 

Line 86 is  
query = $db->query($sql);