apache stop when working with PDO

Problems with the Windows version of XAMPP, questions, comments, and anything related.

apache stop when working with PDO

Postby develturk » 21. August 2009 08:46

XAMPP 1.7.1 under the Vista.
When i use the simple PDO functions apache stop immediately!

Code: Select all
try {
    $hostname = "localhost";            //host
    $dbname = "example";            //db name
    $username = "root";            // username like 'sa'
    $pw = "";                // password for the user

    $options = array(PDO::ATTR_AUTOCOMMIT=>FALSE);
   
    $dbh = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw",$options);
    $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );

    $res = $dbh->query("SELECT * FROM articles");
    while ($row = $res->fetch(PDO::FETCH_ASSOC)){
        echo $row['article']."<br />";
    }
   
    //$sth->execute();
    //$yellow = $sth->fetchAll();
   
    print_r($row);
   
   
   
  } catch (Exception $e) {
    //echo "Failed to get DB handle: " . $e->getMessage() . "\n";
    echo $e;
   
    exit;
  }

develturk
 
Posts: 1
Joined: 21. August 2009 08:39

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 199 guests