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;
}