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
teşekkür ederim ancak durum tam bu değil. Şuan bir arkadaş uğraşıyor olacak mı bilemiyorum ama durumu daha açık özetleyeyim.
db de sınıf - öğrenci - not 1 - not 2olduğunu varsay
5A Ali 50 60
5A Veli 60 70
5B Eda 70 80
durumunda tabloda çıktı şu şekilde olmalıdır. Aynı sınıfları gruplamalı (db de sınıflar sıralı)
5A
Ali 50 60
Veli 60 70
5B
Eda 70 80
örnek tablo çıktısı