ouldfella Posted September 4, 2017 Share Posted September 4, 2017 hi, i created a file named selectcountry.php in the root the content of this file is : use Illuminate\Database\Capsule\Manager as Capsule; $invoice = Capsule::table('voip')->where('iso', $_POST['selectediso'])->get(); i send a variable selected country with ajax method POST the variable is received correctly but i had an error internal server error 500 0 Quote Link to comment Share on other sites More sharing options...
ouldfella Posted September 4, 2017 Author Share Posted September 4, 2017 finally, i added the page structure like this : <?php use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Tarifs et Recharge'); $ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); $ca->addToBreadCrumb('selectcountry.php', 'Tarifs et Recharge'); $ca->initPage(); //$ca->requireLogin(); // Uncomment this line to require a login to access this page // To assign variables to the template system use the following syntax. // These can then be referenced using {$variablename} in the template. //$ca->assign('variablename', $value); // Check login status $tarifs = Capsule::table('voip') ->where('iso', $_POST['selectediso']) ->get(); $tarifs = json_encode($tarifs); echo $tarifs; it works 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted September 4, 2017 WHMCS Developer Share Posted September 4, 2017 You can't access the database connection without including the init.php file. You shouldn't need to define all the client area stuff if all you want is the single variable. 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.