How to handle sqlite3-based Movabletype DB using PDO

Discussion in 'PHP' started by josemayfield, May 9, 2008.

  1. #1
    Hi! I'm now trying to handle sqlite3-based Movabletype DB using PDO.
    My php sciript is below.

    I can connect, but it seems sql dose not work.
    Dose anybody know how to work it?

    Josemayfield
    -----------------------------
    <html>
    <head><title>PDO TEST</title></head>
    <body>

    <?php

    try {
    $dsn = 'sqlite:mt.db';
    $dbh = new PDO($dsn);

    if( ! is_object( $dbh) ){
    echo "connection was failed";
    exit;
    }

    echo "connect!";

    $sql = "SELECT * FROM mt_entry";
    $entries = $pod->query($sql);

    while ($entry = $entries->fetch()) {

    echo $entry . PHP_EOL;

    }
    } catch (PDOException $e){
    var_dump($e->getMessage());
    }
     
    josemayfield, May 9, 2008 IP