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

2022年中国数字科技专题分析

Advanced version of array simulation queue - ring queue (real queuing)

Redis master-slave synchronization

Reptile exercises (1)

Openstack command operation

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

Mysql database explanation (IX)

TLS / SSL protocol details (28) differences between TLS 1.0, TLS 1.1 and TLS 1.2

Detailed explanation of redirection and request forwarding

What exactly does the distributed core principle analysis that fascinates Alibaba P8? I was surprised after reading it
随机推荐
Summary of interfaces for JDBC and servlet to write CRUD
fatal error: torch/extension.h: No such file or directory
Differential privacy (background)
Do keyword search, duplicate keyword search, or do not match
My raspberry PI zero 2W toss notes to record some problems and solutions
Leetcode学习计划之动态规划入门day3(198,213,740)
HJ31 单词倒排
Crawling fragment of a button style on a website
Sword finger offer (2) -- for Huawei
Basic operation of sequential stack
Will golang share data with fragment append
Share 20 tips for ES6 that should not be missed
调度系统使用注意事项
JS - implémenter la fonction de copie par clic
win10 任务栏通知区图标不见了
Detailed explanation of MySQL connection query
adobe illustrator 菜单中英文对照
regular expression
Comparaison du menu de l'illustrateur Adobe en chinois et en anglais
About UDP receiving ICMP port unreachable