Reply to thread

Yes, I know that PDO is MySQL just new and well not dead lol. The problem where I run into is from the old stuff which I am looking at for a template to add

[CODE=php]class core implement iCore

{

    #codes

  

    #code

  

    #more-codes

}[/CODE]

Like the config.php for example everything I look at to set up the pdo database stuff is like:

[CODE=php]$hostname = "localhost";

$username = "username";

$password = "password";


try {

  $conn = new PDO("mysql:host=$hostname;dbname=myDB", $username, $password);

  // set the PDO error mode to exception

  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  echo "Connected successfully";

} catch(PDOException $e) {

  echo "Connection failed: " . $e->getMessage();

}



/*

Vs RevCMS config

*/

if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }


/*

*


* Database Management


*

*/


$_CONFIG['

mysql']['connection_type'] = 'connect';


$_CONFIG['mysql']['hostname'] = 'localhost'; // MySQL host | Example: localhost or 127.0.0.1


$_CONFIG['mysql']['username'] = 'root'; // MySQL username / loging name | Example: root


$_CONFIG['mysql']['password'] = 'Password'; // MySQL Password / leave blank if no PHPMyAdmin password | Example: 'Tester' or (if no password) ''


$_CONFIG['mysql']['database'] = 'database1'; // MySQL database / schema


$_CONFIG['mysql']['port'] = '3306'; // MySQL port

[/CODE]


So my question is how would you implement pdo connecting to db vs the config part or am I looking at it wrong and it would be how the class.engine.php grabs it?


Top