Dreamweaver:如何在不使用表格的情况下在单行中显示记录集

发布于 2024-10-13 15:19:02 字数 785 浏览 2 评论 0原文

我是 Dreamweaver CS5 和 MySQL 用户,我正在尝试实现一个在线商店,客户可以在其中查看和购买图像或视频。我在 SQL 服务器上有一个表,用于跟踪有关图片的所有信息。即长度、格式、标题、专辑、价格等。我知道如何获取要显示的数据以及如何创建记录集并传递客户搜索/购物时所需的参数。

我的问题是...如何获取数据的结果或记录集以自定义格式而不是表格显示。例如,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

上面就是Dreamweaver是如何实现的,以及我是如何知道数据可以显示的。 我如何显示它,如下所示:

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

如何以这种格式显示我的记录或结果?

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. I have a table on the SQL server that will keep track of all information about pictures. i.e., 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. For an example Dreamweaver provided dynamic tables to display results or dynamic text.

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.
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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

童话里做英雄 2024-10-20 15:19:02

如下所示:

<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)); ?>

此代码的作用是循环遍历 DIV 标记,该标记包含“列”类型输出中记录集中每一行的输出。边框样式用于显示数据块的位置,根据需要删除/更新。

您可能会遇到列数对于内容区域来说太宽的问题,然后您可能希望将 CSS 选择器移至 float:left 而不是 display:inline-block。你可能会遇到列高的问题(当数据输出变化很大时,试图使 DIV 具有相同的高度(想想产品细节可能是一个短句子或二十个长段落),这将是一个需要单独提出的 CSS 问题(当然,或者首先搜索)

注意:即使记录集结果中没有行,默认的 Dreamwavqer 代码也会运行一次记录集循环代码,因此您需要使用 Show Region -> 来包装此代码。显示记录集是否不为空

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. 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. 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).

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文