<html> <head><title>PHP TEST</title></head> <body> <?php require_once 'DB.php'; $dsn = 'mysqli://testuser:testuser@localhost/uriage'; $db = DB::connect($dsn); if (PEAR::isError($db)) { die($db->getMessage()); } print('接続に成功しました<br>'); $db->query('SET NAMES sjis'); if (PEAR::isError($db)) { die($db->getMessage()); } $sql = 'select * from shouhin'; $res =& $db->query($sql); if (PEAR::isError($res)) { die($res->getMessage()); } while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { print($row['id']); print($row['name'].'<br>'); } $db->disconnect(); ?> </body> </html>