[英]Dreamweaver: How to display recordsets in a single row without using a table
I am a Dreamweaver CS5 and MySQL user, a I am trying to implement an online store where customers can view and buy images or video. 我是Dreamweaver CS5和MySQL的用户,我正在尝试建立一个在线商店,客户可以在其中查看和购买图像或视频。 I have a table on the SQL server that will keep track of all information about pictures.
我在SQL Server上有一张表,该表将跟踪有关图片的所有信息。 ie, length, format, title, album, price, etc. I know how to get data to be displayed and how to create the recordset and pass parameters that are needed when the customers do their search / shopping.
即长度,格式,标题,专辑,价格等。我知道如何获取要显示的数据,如何创建记录集并传递客户进行搜索/购物时所需的参数。
My question is... How do I get the RESULTS of the data, or the Recordset to display in a custom format other than a table. 我的问题是...如何获取数据结果或Recordset以表以外的自定义格式显示。 For an example Dreamweaver provided dynamic tables to display results or dynamic text.
例如,Dreamweaver提供了动态表来显示结果或动态文本。
Field A | Field B | Field C | Field D | Field E | Field F | Field G |
122 Orange 48 x 29 Color 19.99 Jones Photography picture.gif
The above is how Dreamweaver, and how I know that data can be displayed. 以上是Dreamweaver的方式,以及我如何知道可以显示数据的方式。 How do I display it like this below:
我如何在下面显示它:
Record 1 Record 2 Record 3 (Same format), and so on....
Field G (Picture.gif) Field G
Field A Field A
Field B Field B
Field C Field C
Field D Field D
Field E
How do I display my records or results in this format? 如何以这种格式显示我的记录或结果?
Something like the following: 类似于以下内容:
<style>
div.rsColumn{
display: inline-block;
border: solid 1px #000;
}
</style>
<?php do { ?>
<div class="rsColumn">
<?php echo $row_Recordset1['Column1']; ?><br />
<?php echo $row_Recordset1['Column2']; ?><br />
<?php echo $row_Recordset1['Column3']; ?><br />
<?php echo $row_Recordset1['ColumnLast']; ?>
</div>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
What this code does is to loop over a DIV tag that contains output for each row in the recordset in a "column" type of output. 这段代码要做的是循环遍历DIV标记,该标记包含记录集中每一行的输出,并以“列”类型输出。 The border styling is to show where your data blocks are, remove/update as necessary.
边框样式将显示您的数据块在哪里,如有必要,请删除/更新。
You'll likely run into issues where the number of columns is too wide for you content area, and then you may want to move to float:left for the CSS selector rather than display:inline-block. 您可能会遇到这样的问题,即列数对于您的内容区域而言太宽了,然后您可能想将CSS选择器的float:left移到display:inline-block上。 And you may run into issues with column heights (trying to make DIV have the same height when the data output varies greatly (think product details that could be a single short sentence or twenty long paragraphs), that would be a CSS question to ask separately (or search first, of course).
而且您可能会遇到列高的问题(当数据输出变化很大时,试图使DIV具有相同的高度(请考虑产品详细信息,可以是一个短句子或二十个长段落),这将是一个CSS问题,需要单独询问(或先搜索)。
Note: the default Dreamwavqer code will run through a recordset loop code once even if the recordset has no rows in the result, so you'll need to wrap this code with a Show Region -> Show If Recordset Is Not Empty 注意:即使记录集在结果中没有行,默认的Dreamwavqer代码也会在记录集循环代码中运行一次,因此您需要使用Show Region-> Show If Recordset Is Not Empty包装此代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.