This one time, at band camp, "yuyen" <[EMAIL PROTECTED]> wrote:

> HI, JC
> I use php_do_sqlite with PHP 5.1.4 and Sqlite 3.2.8 on Windows XP. The 
> following is my coding:

---------8< ------------------------snip

try { 
    $dbh = new PDO("sqlite:counter/cntdata.sq3"; 
    /*** echo a message saying we have connected ***/ 
    echo 'Connected to database<br />'; 

    /*** set the PDO error mode to exception ***/ 
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
     
    /*** our sql statement ***/ 
    $sql = 'UPDATE test_item SET balqty = 100'; 

    /*** we use PDO::exec because no results are returned ***/ 
    $dbh->exec($sql); 

    /*** give praise and thanks to the PHP/SQLite gods ***/ 
    echo 'Item updated successfully<br />'; 
    } 
catch(PDOException $e) 
    { 
    /*** echo the sql statement and error message ***/ 
    echo $sql . '<br />' . $e->getMessage(); 
    } 
?>

Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

Reply via email to