当前位置:网站首页>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
边栏推荐
- C language super complete learning route (collection allows you to avoid detours)
- JS -- realize click Copy function
- fatal error: torch/extension.h: No such file or directory
- 调度系统使用注意事项
- Explanation of redis database (III) redis data type
- Mysql连接查询详解
- Difference between like and regexp
- Crawling fragment of a button style on a website
- Comparaison du menu de l'illustrateur Adobe en chinois et en anglais
- 软件性能测试报告起着什么作用?第三方测试报告如何收费?
猜你喜欢
随机推荐
Subnet division of flannel principle
免费在upic中设置OneDrive或Google Drive作为图床
【thymeleaf】处理空值和使用安全操作符
Have you really learned the operation of sequence table?
Detailed explanation of C language knowledge points -- first understanding of C language [1] - vs2022 debugging skills and code practice [1]
Collation of errors encountered in the use of redis shake
Detailed explanation of MySQL connection query
Async keyword
Precautions for use of dispatching system
The wechat applet optimizes the native request through the promise of ES6
What exactly does the distributed core principle analysis that fascinates Alibaba P8? I was surprised after reading it
Have you learned the basic operation of circular queue?
如何设计一个良好的API接口?
我的树莓派 Raspberry Pi Zero 2W 折腾笔记,记录一些遇到的问题和解决办法
Nacos程序连接MySQL8.0+ NullPointerException
How to design a good API interface?
【backtrader源码解析18】yahoo.py 代码注释及解析(枯燥,对代码感兴趣,可以参考)
Detailed explanation of C language knowledge points -- data types and variables [1] - carry counting system
The win10 taskbar notification area icon is missing
Functions (Part I)









