title: ModX Revo Insert to Database
body: <p>I am a newbie in ModX, trying to insert to database but always failed. This is my insert script :</p>
  
  <pre><code>&lt;?php
  define('MODX_CORE_PATH', '/aocore/');
  define('MODX_CONFIG_KEY','config');
  require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
  
  $host = 'localhost';
  $username = 'asdsadsada';
  $password = 'dsadsadsada';
  $dbname = 'sadsadsadsadas';
  $port = 3306;
  $charset = 'utf8';
  
  $dsn = "mysql:host=$host;dbname=$dbname;port=$port;charset=$charset";
  $xpdo = new xPDO($dsn, $username, $password);
   echo $o = ($xpdo-&gt;connect()) ? 'Connected' : 'Not Connected';
  $results = $xpdo-&gt;query("insert into table_name (name,email) VALUES ('".$_POST['name'].",".$_POST['email']."')"); 
  $stmt = $modx-&gt;prepare($results);
  $stmt-&gt;execute();
  ?&gt;
  </code></pre>
  
  <p>Please help, totally stuck here.</p>
  
  <p>Thanks</p>