prepare($sql); if ($stmt) { if (!empty($params)) { $stmt->bind_param($types, ...$params); } $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { $rows[] = $row; } $stmt->close(); } } if (empty($rows)) { echo "ไม่มีข้อมูลที่ต้องการค้นหา"; } else { $num = 1; foreach ($rows as $row) { $encoded_hn = base64_encode($row['hn']); echo ""; echo "" . $num . ""; echo "" . htmlspecialchars($row['hn']) . ""; echo "" . htmlspecialchars($row['pname'] . $row['fname'] . " " . $row['lname']) . ""; echo "" . htmlspecialchars($row['cid']) . ""; echo "ดูข้อมูล"; echo ""; $num++; } } ?>