Revision: 41259
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 15, 2011 02:39 by thepiglovesyou
Initial Code
// connect DB $dsn = array( 'phptype' => 'mysql', 'username' => '---username---', 'password' => '---password---', 'hostspec' => '---host---', 'database' => '---db name---' ); $options = array( 'portability' => MDB2_PORTABILITY_ALL ); function errorHandler($error){ die( "エラー発生 {$error->getMessage()}" ); } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errorHandler'); $mdb2 =& MDB2::connect($dsn, $options); $sql = 'set names utf8'; $res =& $mdb2->query($sql); $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
Initial URL
Initial Description
Initial Title
MySQL: start connecting to MySQL with PEAR::MDB2
Initial Tags
Initial Language
PHP