<?php
try{
$db = new PDO("mysql:host=localhost;dbname=demo;charset=utf8", "root", "roottoor");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e){
echo "Bağlantı hatası: " . $e->getMessage();
}
$query = $db->prepare("SELECT * FROM sitekategoriler");
$query->execute();
if($query->rowCount()){
foreach($query as $row){
echo $row['kat_adi']."<br />";
}
}
?>