当前位置:网站首页>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
边栏推荐
猜你喜欢

Nuxt project: Global get process Env information

【Leetcode-每日一题】安装栅栏

Mysql database explanation (IX)

API gateway / API gateway (II) - use of Kong - load balancing

Redis master-slave synchronization

G007-hwy-cc-estor-03 Huawei Dorado V6 storage simulator construction

Lotus DB design and Implementation - 1 Basic Concepts

Kubernetes详解(十一)——标签与标签选择器

Share 20 tips for ES6 that should not be missed

Deep learning - Super parameter setting
随机推荐
How to write the keywords in the cover and title? As we media, why is there no video playback
PSYNC synchronization of redis source code analysis
8.5 concise implementation of cyclic neural network
Ffmpeg installation error: NASM / yasm not found or too old Use --disable-x86asm for a clipped build
Llvm - generate for loop
如果conda找不到想要安装的库怎么办PackagesNotFoundError: The following packages are not available from current
Leetcode学习计划之动态规划入门day3(198,213,740)
Detailed explanation of C language knowledge points -- first understanding of C language [1] - vs2022 debugging skills and code practice [1]
UML learning_ Day2
Mysql database explanation (IX)
Have you really learned the operation of sequence table?
Wechat applet customer service access to send and receive messages
How to upload large files quickly?
The win10 taskbar notification area icon is missing
【thymeleaf】处理空值和使用安全操作符
深度学习调参的技巧
Detailed explanation of kubernetes (IX) -- actual combat of creating pod with resource allocation list
Detailed explanation of redirection and request forwarding
Async keyword
Set onedrive or Google drive as a drawing bed in upic for free