json çıktı alırken kod yapim bu; json.php <?php
$dbh = new PDO("mysql:host=localhost;dbname=hastag", "root", "");
$stmt = $dbh->query("SELECT id, name,surname, birth, ip FROM koop WHERE ip like 'KAPI' ORDER BY birth");
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
//print_r($rows);
$liste = array();
foreach ($rows as $row) {
$list = array();
$list["id"] = $row["id"];
$list["name"] = $row["name"];
$list["surname"] = $row["surname"];
$list["ip"] = $row["ip"];
array_push($liste, $list);
}
echo json_encode($liste);
?>listeleme kodum bu: listele.php
<?php
include("conn.php");
$sorgu=$vt->prepare("SELECT id, name,surname, birth, ip FROM koop WHERE ip like 'KAPI' ORDER BY birth");
$sorgu->execute();
$row_count = $sorgu->rowCount();
echo $row_count.' kapi verisi var.';
$personellist=$sorgu-> fetchAll(PDO::FETCH_OBJ);
?>
<table class="table table-bordered table-striped table-dark">
<tr>
<td>ID</td>
<td>Ad</td>
<td>Soyad</td>
<td>DOĞUM TARİHİ</td>
<td>ip</td>
</tr>
<?php
foreach($personellist as $person){?>
<tr>
<td><?= $person->id ?></td>
<td><?= $person->name?></td>
<td><?= $person->surname?></td>
<td><?= $person->birth?></td>
<td><?= $person->ip?></td>
</tr>
<?php } ?>
</table>