hpk Posted January 11, 2016 Share Posted January 11, 2016 Hello, I am trying to use new whmcs sql helper functions listed here: http://docs.whmcs.com/SQL_Helper_Functions However including the following directly in page: <?php require_once('/home/acct/public_html/whmcs/vendor/autoload.php'); use Illuminate\Database\Capsule\Manager as Capsule; // Print all client first names using a simple select. /** @var stdClass $client */ foreach (Capsule::table('tblclients')->get() as $client) { echo $client->firstname . PHP_EOL; } // Rename all clients named "John Deo" to "John Doe" using an update statement. try { $updatedUserCount = Capsule::table('tblclients') ->where('firstname', 'John') ->where('lastname', 'Deo') ->update( [ 'lastname' => 'Doe', ] ); echo "Fixed {$updatedUserCount} misspelled last names."; } catch (\Exception $e) { echo "I couldn't update client names. {$e->getMessage()}"; } results in error: Call to a member function connection() on a non-object in /home/acct/public_html/whmcs/vendor/illuminate/database/Illuminate/Database/Capsule/Manager.php on line 110 Any help? Thanks a lot! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 11, 2016 Share Posted January 11, 2016 you did not make connection to DB, replace this line: require_once('/home/acct/public_html/whmcs/vendor/autoload.php'); with this one: require_once('/home/acct/public_html/whmcs/init.php'); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.