SHARE
TWEET

Untitled

a guest Jan 25th, 2016 304 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5.  
  6.   <?php
  7.  
  8. require_once 'xpdo-2.4-3.0-pl/xpdo.class.php';
  9.  
  10. // Criteria for foreign Database
  11. $host = 'expharm.miniserver.cz';
  12. $username = 'jlochman';
  13. $password = '******';
  14. $dbname = 'modx_obchmodel';
  15. $table_prefix = 'expharm_';
  16. $port = 3306;
  17. $charset = 'utf8';
  18.  
  19. $dsn = "mysql:host=$host;dbname=$dbname;port=$port;charset=$charset";
  20. $xpdo = new xPDO($dsn, $username, $password, $table_prefix);
  21.  
  22. // Test your connection
  23. echo $o = ($xpdo->connect()) ? 'Connected' : 'Not Connected';
  24. echo "\n";
  25.  
  26. /*
  27. $manager= $xpdo->getManager();
  28. $generator= $manager->getGenerator();
  29.  
  30. $schema = './schema/expharm.mysql.schema.xml';
  31. $target = './model/';
  32. $generator->parseSchema($schema,$target);
  33.  */
  34.  
  35. if ( ! $xpdo->addPackage('expharm', './model/', 'expharm_') ) {
  36.   die('error loading package');
  37. }
  38.  
  39. $users = $xpdo->getCollection( 'Users', array('last_name:LIKE' => '%') );
  40. foreach($users as $user) {
  41.   echo $user->get("first_name");
  42. }
  43.  
  44.  
  45.     ?>
  46.  
  47. </body>
  48. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top