当前位置:网站首页>Connectez PHP à MySQL via aodbc
Connectez PHP à MySQL via aodbc
2022-04-23 15:26:00 【Allway2】
<?php
$hostname = "localhost";
$database = "db";
$username = "root";
$password = "root";
try {
$pdo = new PDO("odbc:Driver={MySQL ODBC 3.51 Driver};host=$hostname;database=$database", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT id,name,city FROM mytable";
$stmt = $pdo->query($sql);
while ($row = $stmt->fetch()) {
print( $row[0] . "-" . $row[1] . "-" . $row[2] . "\r\n");
}
} catch (PDOException $e) {
echo $e->getMessage();
exit;
}
# close the connection
$dbh = null;
?>
版权声明
本文为[Allway2]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231525131224.html
边栏推荐
猜你喜欢
setcontext getcontext makecontext swapcontext
Introduction to distributed transaction Seata
Openstack command operation
How to use OCR in 5 minutes
电脑怎么重装系统后显示器没有信号了
For 22 years, you didn't know the file contained vulnerabilities?
MySQL InnoDB transaction
Differential privacy (background)
Functions (Part I)
Five data types of redis
随机推荐
Baidu written test 2022.4.12 + programming topic: simple integer problem
Have you really learned the operation of sequence table?
自主作业智慧农场创新论坛
移动app软件测试工具有哪些?第三方软件测评小编分享
Mysql database explanation (IX)
8.2 text preprocessing
木木一路走好呀
Three uses of kprobe
Kubernetes详解(九)——资源配置清单创建Pod实战
网站某个按钮样式爬取片段
Sword finger offer (1) -- for Huawei
kubernetes之常用Pod控制器的使用
Detailed explanation of redirection and request forwarding
Ffmpeg installation error: NASM / yasm not found or too old Use --disable-x86asm for a clipped build
字节面试 transformer相关问题 整理复盘
Compiling OpenSSL
Squid agent
Openfaas practice 4: template operation
How to use OCR in 5 minutes
Deep learning - Super parameter setting