اعتذر اليك، لم انتبه ان الموضوع في قسم PHP
من الجيد انك وضعت كود كبداية للعمل عليه
وكان من الأفضل وضع سكريبت قاعدة البيانات وكود الاستعلام الذي لديك ليسهل وضع الحل المناسب لك
من الجيد انك وضعت كود كبداية للعمل عليه
وكان من الأفضل وضع سكريبت قاعدة البيانات وكود الاستعلام الذي لديك ليسهل وضع الحل المناسب لك
PHP كود :
<table border=1 cellpadding=5 cellspacing=0>
<thead>
<tr bgcolor=WhiteSmoke>
<th>#</th>
<th>Description</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$sections = $conn->prepare("SELECT DISTINCT MainSection FROM table1");
$sections->execute();
while ($s = $sections->fetch()) {
echo "<th bgcolor=lightgray colspan=3 align=left>{$s['MainSection']}</th>";
$result = $conn->prepare("SELECT * FROM table1 WHERE MainSection='{$s['MainSection']}' ");
$result->execute();
while ($r = $result->fetch()) {
echo "<tr>";
echo "<td align=center>{$r['Section']}</td>";
echo "<td>{$r['Description']}</td>";
echo "<td align=center>{$r['Total']}</td>";
echo "</tr>";
}
}
?>
</tbody>
</table>