|
|
|
Multiple Column ทำไมมันเป็นอย่างนี้!!! ช่วยทีครับ |
|
|
|
|
|
|
|
Uploaded with ImageShack.us
ได้โค้ดมาจาก เว็บเรานี่แหละครับ พี่วินเขียนไว้
พอใส่ใน table มันเด้งออกนอก table ครับ แถวแรกเลยเกย เพราะว่าแถวแรกมันติด table ทีเราใส่เข้าไป
แก้ยังไงครับ ช่วยทีครับ
ไม่เก่ง code ครับ เลย งง หนัก - -"
code ครับ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><!--#include file="aspdb_connect.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<title>1</title>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
<style type="text/css">
body{ color: #333; font: 13px 'Lucida Grande', Verdana, sans-serif; }
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="240" height="213" valign="top" bgcolor="#CCCCCC"><table width="6%" border="0" align="center" cellpadding="0" cellspacing="0" class="txtContent11">
<tr>
<td colspan="2" bgcolor="#FFFFFF" class="txtcontentM4">
<%
set rs6 = server.CreateObject("adodb.recordset")
sql6 ="select *from product_group order by group_id "
rs6.open sql6,conn,1,3
%>
</td>
</tr>
<%do while not rs6.eof %>
<tr>
<td width="6"> </td>
<td width="235" class="txtcontentM4"><table width="235" border="0" cellpadding="1" cellspacing="1">
<td height="20" colspan="2" class="txtContentBoldWhite"><img src="../images/5_80.gif" width="9" height="9" /> <span class="txtContentBold10"><a href="product.asp?gid=<%=rs6("group_id")%>"><%=rs6("group_name")%> </a>
<%h_id=rs6("group_id")%>
</span></td>
</tr>
<%
set rs7 = server.CreateObject("adodb.recordset")
sql7 ="select *from product_subgroup where group_id= '"&h_id&"' order by subgroup_id ASC"
rs7.open sql7,conn,1,3
%>
<%do while not rs7.eof %>
<tr>
<td width="1%" height="19" class="txtcontentM4"><div align="right"></div></td>
<td class="txtContent11"> <img src="images/yellowdot_b.gif" width="10" height="10"><a href="product.asp?gid=<%=h_id%>&sgid=<%=rs7("subgroup_id")%>"><%=rs7("subgroup_name")%> </a> </td>
</tr>
<%
rs7.movenext
i=i+1
loop
rs7.close
%>
</table></td>
</tr>
<%
rs6.movenext
i=i+1
loop
rs6.close
%>
</table></td>
<td width="10" valign="top" bgcolor="#999999"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="0" height="0"> </td>
</tr>
</table></td>
<td width="750" valign="top" bgcolor="#FFFFFF"><table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF">
<%gid=request.QueryString("gid")%>
<%sgid=request.QueryString("sgid")%>
<%
if sgid ="" then
set rs= server.CreateObject("adodb.recordset")
sql ="select *from product where pd_group_id= '"&gid&"' order by pd_code "
rs.open sql,conn,1,3
else
set rs= server.CreateObject("adodb.recordset")
sql="select *from product where pd_group_id= '"&gid&"' and pd_subgroup_id= '"&sgid&"' order by pd_code "
rs.open sql,conn,1,3
end if
%>
<%
intRows = 0
While Not rs.EOF
intRows = intRows + 1
Response.Write("<td>")
%>
<br>
<br>
<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="pd_images/<%= Rs("pd_imgshow")%>" rel="lightbox"><img src="pd_images/<%= Rs("pd_imgicon")%>" width="160" height="160" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center" class="txtContentBold10"><%= Rs("pd_code")%><br>
<%= Rs("pd_name")%><br>
ราคา<%= Rs("pd_priceshow")%> บาท <br>
<br>
<br>
</div></td>
</tr>
</table>
<%
Response.Write("</td>")
If intRows Mod 3= 0 Then
Response.Write("</tr>")
Else
Response.Write("<td>")
End IF
rs.MoveNext
Wend
Response.Write("</tr></table>")
rs.Close()
Conn.Close()
Set rs = Nothing
Set Conn = Nothing
%></td>
</tr>
</table>
</TABLE>
</td>
</tr>
</table>
</body>
</html>
Tag : - - - -
|
|
|
|
|
|
Date :
2010-05-27 16:28:07 |
By :
odin |
View :
1341 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<%
Dim Conn,strSQL,objRec,intRows
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/mydatabase.mdb"),"" , ""
strSQL = "SELECT * FROM gallery "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
Response.Write("<table border='0' cellspacing='1' cellpadding='1'><tr>")
intRows = 0
While Not objRec.EOF
intRows = intRows + 1
Response.Write("<td>")
%>
<center>
<img src="shotdev/<%=objRec.Fields("Picture").Value%>"><br>
<%=objRec.Fields("GalleryName").Value%>
<br>
</center>
<%
Response.Write("</td>")
If intRows Mod 2 = 0 Then
Response.Write("</tr>")
End If
objRec.MoveNext
Wend
Response.Write("</tr></table>")
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</body>
</html>
ลองดู Code นี้น่ะครับ
|
|
|
|
|
Date :
2010-05-28 00:35:47 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ ได้แล้ว เย้ เย้ พอดีไม่ค่อยเข้าใจเรื่อง code table ส่วนใหญ่จะทำในดรีมครับ
เจอ td tr ไม่ค่อยเก็ตเลย
|
|
|
|
|
Date :
2010-05-28 08:24:00 |
By :
odin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|