当前位置:网站首页>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
边栏推荐
- Kubernetes详解(十一)——标签与标签选择器
- Modify the default listening IP of firebase emulators
- 8.3 language model and data set
- Introduction to distributed transaction Seata
- T2 iCloud日历无法同步
- setcontext getcontext makecontext swapcontext
- JS -- realize click Copy function
- Design of digital temperature monitoring and alarm system based on DS18B20 single chip microcomputer [LCD1602 display + Proteus simulation + C program + paper + key setting, etc.]
- What exactly does the distributed core principle analysis that fascinates Alibaba P8? I was surprised after reading it
- Share 20 tips for ES6 that should not be missed
猜你喜欢
重定向和请求转发详解
8.4 realization of recurrent neural network from zero
免费在upic中设置OneDrive或Google Drive作为图床
UML learning_ Day2
Five data types of redis
Thinkphp5 + data large screen display effect
Kubernetes详解(十一)——标签与标签选择器
深度学习——超参数设置
API gateway / API gateway (III) - use of Kong - current limiting rate limiting (redis)
About UDP receiving ICMP port unreachable
随机推荐
T2 icloud calendar cannot be synchronized
电脑怎么重装系统后显示器没有信号了
Mysql连接查询详解
Basic operation of circular queue (Experiment)
[thymeleaf] handle null values and use safe operators
Nuxt project: Global get process Env information
The win10 taskbar notification area icon is missing
G007-HWY-CC-ESTOR-03 华为 Dorado V6 存储仿真器搭建
【Leetcode-每日一题】安装栅栏
ffmpeg安装遇错:nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
Application of skiplist in leveldb
Redis cluster principle
如何设计一个良好的API接口?
JUC学习记录(2022.4.22)
重定向和请求转发详解
免费在upic中设置OneDrive或Google Drive作为图床
A series of problems about the best time to buy and sell stocks
激活函数的优缺点和选择
Leetcode学习计划之动态规划入门day3(198,213,740)
Openstack command operation