sql ile cek

tek sayfa bir datatable ile kendi tablonu oluştur.
<?php
require_once __DIR__ . '/wp-config.php';
global $wpdb;
$users = $wpdb->prefix . 'users';
$usermeta = $wpdb->prefix . 'usermeta';
$sql = "
SELECT
u.ID AS user_id,
u.user_login,
u.user_email,
um.meta_value AS telefon
FROM $users u
INNER JOIN $usermeta um ON um.user_id = u.ID
WHERE um.meta_key = 'billing_phone'
AND um.meta_value <> ''
ORDER BY u.ID DESC
";
// Sorgu
$results = $wpdb->get_results($sql);
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Müşteri Telefonları</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f4f4f4;
padding: 20px;
}
table {
width: 100%;
border-collapse: collapse;
background: #fff;
}
th, td {
border: 1px solid #ddd;
padding: 10px;
font-size: 14px;
}
th {
background: #1f2937;
color: #fff;
}
tr:nth-child(even) {
background: #f9f9f9;
}
h2 {
margin-bottom: 15px;
}
</style>
</head>
<body>
<h2>WooCommerce Müşteri Telefon Listesi</h2>
<table>
<thead>
<tr>
<th>#</th>
<th>User ID</th>
<th>Kullanıcı Adı</th>
<th>E-posta</th>
<th>Telefon</th>
</tr>
</thead>
<tbody>
<?php if ($results): $i = 1; ?>
<?php foreach ($results as $row): ?>
<tr>
<td><?= $i++; ?></td>
<td><?= esc_html($row->user_id); ?></td>
<td><?= esc_html($row->user_login); ?></td>
<td><?= esc_html($row->user_email); ?></td>
<td><?= esc_html($row->telefon); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="5">Kayıt bulunamadı</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</body>
</html>