setting .php
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
if (stristr(htmlentities($_SERVER['PHP_SELF']), "setting.php")) {
Header("Location: /");
die();
}
try {
$db = new PDO("mysql:host=localhost;dbname=contentsite;charset=utf8", "root", "");
} catch ( PDOException $e ){
print $e->getMessage();
}
?>index.php
<?php
$sql=$db->query("select * from tablo_adi where sart='1' and ptype='post' order by id DESC LIMIT 1");
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
$sinif=htmlentities($row['sinif']);
$ogrenci=$row['ogrenci'];
?>al hocam sana döngülü örnek