PDO 查询mysql数据库

作者:袖梨 2022-06-24
 代码如下 复制代码
try {
    $dbh = new pdo($beidou_connstr,$beidou_user,$beidou_pass);
    foreach ($dbh->query('select count(*) as count1, count(*) as count2 from bd_reve.user_day') as $row) {
        print_r($row);
    }
    $dbh = null;
} catch (pdoexception $e) {
    print "error!: " . $e->getmessage() . "
";
    die();
}

相关文章

精彩推荐