<?php
// İlk sorgu: Tüm paketleri al
$getDbPacksx = $spexcon->query("SELECT * FROM pakets");
// İkinci sorgu: Kullanıcının repacks tablosundaki kayıtlarını al
$sorgu = $spexcon->query("SELECT * FROM repacks WHERE user='".$user_name."' ");
// $pakets_id'leri depolamak için boş bir dizi oluştur
$pakets_ids = array();
// İkinci sorgudan gelen her bir kayıt için
while ($row = $sorgu->fetch_assoc()) {
// repacks tablosundaki pakets_id'yi diziye ekle
$pakets_ids[] = $row['pakets_id'];
}
// Tüm paketlerin bulunduğu sorgudan gelen her bir kayıt için
while ($pack_row = $getDbPacksx->fetch_assoc()) {
// Eğer pakets_id repacks tablosundaki kayıtlarda bulunuyorsa
if (in_array($pack_row['id'], $pakets_ids)) {
echo "Paket alınmıştır: " . $pack_row['paket_adi'] . "<br>";
}
}
?>