ช่วยบอกวิธึการเอาข้อมูลออกมาแสดงทีครับ
<?php require_once('../Connections/thaiindexz.php'); ?><?php require_once('../Connections/thaiindexz.php');
$cols = 2;
$c = $cols;
?>
<?php
mysql_select_db($database_thaiindexz, $thaiindexz);
$query_show = "SELECT * FROM main ORDER BY id_main ASC";
$show = mysql_query($query_show, $thaiindexz) or die(mysql_error());
$row_show = mysql_fetch_assoc($show);
$totalRows_show = mysql_num_rows($show);
mysql_select_db($database_thaiindexz, $thaiindexz);
$query_showsub = "SELECT * FROM sub ORDER BY id_main ASC";
$showsub = mysql_query($query_showsub, $thaiindexz) or die(mysql_error());
$row_showsub = mysql_fetch_assoc($showsub);
$totalRows_showsub = mysql_num_rows($showsub);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#Show All Main Categoly and Sub Categoly#</title>
<link href="../StyleSheet/Style_sheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<?php do { $c --;?>
<td width="70" height="80" valign="bottom"><img src="../add_cat/thumbcat/<?php echo $row_show['main_pic']; ?>" width="60" height="60" class="boxpic" /></td>
<td width="250" height="80" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" class="font6"><a href="main_cat.php?id_main=<?php echo $row_show['id_main']; ?>"><?php echo $row_show['main_name']; ?></a></td>
</tr>
<tr>
<td height="50" valign="top" class="font6"><?php echo $row_showsub['sub_name']; ?></td>
</tr>
</table></td>
<? if($c == 0) { $c = $cols;?>
</tr>
<?php }} while ($row_show = mysql_fetch_assoc($show));?>
</table>
</body>
</html>
<?php
mysql_free_result($show);
mysql_free_result($showsub);
?>
วิธีการจริงๆก็ขึ้นอยู่กับการออกแบบ db ครับ ออกแบบ db ดีก็ query ง่ายครับ