Hi Guys,
I want to use Ajax to pull xpdo requests from the server.
When I click on submit, the following script is executed on the server:
<?php
define('MODX_CORE_PATH', '/var/www/html/raf/core/');
define('MODX_CONFIG_KEY','config');
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$host = 'localhost';
$username = 'admin';
$password = 'p4ssword';
$dbname = 'dbase1';
$charset = 'utf-8';
$dsn = "mysql:host=$host;dbname=$dbname;charset=$charset";
$xpdo = new xPDO($dsn, $username, $password);
echo $o = ($xpdo->connect()) ? 'Connected' : 'Not Connected';
$results = $xpdo->query("SELECT id FROM some_table");
$recordCount = $results->rowCount();
print $recordCount;
Unfortunately the result is always "Not Connected".
[ed. note: ohlala last edited this post 8 years, 6 months ago.]