首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未找到驱动程序- PDO - AMPPS

未找到驱动程序- PDO - AMPPS
EN

Stack Overflow用户
提问于 2013-11-11 15:16:04
回答 1查看 1.8K关注 0票数 0

我使用MAMP已经有几个月了,但是今天我安装了AMPPS。

我将处理数据库,但它不起作用。我得到以下错误:

代码语言:javascript
复制
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /Applications/AMPPS/www/functions.php:13 Stack trace: #0 /Applications/AMPPS/www/functions.php(13): PDO->__construct('mysql:host=loca...', 'root', 'usbw') #1 /Applications/AMPPS/www/functions.php(22): dbConn() #2 /Applications/AMPPS/www/test.php(18): imageDropdown('s') #3 {main} thrown in /Applications/AMPPS/www/functions.php on line 13

代码:

代码语言:javascript
复制
// database connection
function dbConn() {

    $username = "root";
    $password = "usbw";

    $dbh = new PDO(
        'mysql:host=localhost; port=3306; dbname=webshop',
        $username,
        $password
    );

    return $dbh;

}

// dropdown met afbeeldingen
function imageDropdown($zoek) {

    $dbh = dbConn();

    $sth = $dbh -> prepare("

        SELECT afbeelding
        FROM Afbeelding
        WHERE afbeelding LIKE '%:zoek%'
        ORDER BY afbeelding

    ");

    $sth -> bindValue(":zoek", $zoek, PDO::PARAM_STR);

    $sth -> execute();

    $result = $sth -> fetchAll(PDO::FETCH_ASSOC);

    print("<pre>");
    print_r($result);
    print("</pre>");

}

?>

(functions.php)

代码语言:javascript
复制
        <?php

        include "functions.php";

        imageDropdown("s");

    ?>

(test.php)

有一个司机失踪了,但我如何安装它?

我在麦克身上。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-11 19:53:06

在用户界面中- PHP选项卡- php扩展。检查是否启用了所需的扩展。比如pdo_mysql和pdo

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19909692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档