Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Populating a Table with the Results of a Recordset

Posted on 2006-05-09
7
Medium Priority
?
220 Views
Last Modified: 2010-04-25
Hi All,
I want to populate a table on the main page with the contents of a certain data-field from the database. I can get the result to display, my only problem is I want each cell to contain one field (from the RS) and I want the table formatted so that it has 3 cols and has a varying amount of rows based on the result of the query. I also need to make the width and height of each cell an exact side (the same size each time).
Thanks,
D
0
Comment
Question by:dereksheahan
  • 4
  • 2
7 Comments
 
LVL 25

Assisted Solution

by:Rouchie
Rouchie earned 200 total points
ID: 16638910
In ASP, something like this...

<table>

   <%
   WHILE NOT RS.EOF %>

       <tr>
         <td><%=RS("Field1")%></td>
         <td><%=RS("Field2")%></td>
         <td><%=RS("Field3")%></td>
       </tr>
       <tr>
         <td><%=RS("Field4")%></td>
         <td><%=RS("Field5")%></td>
         <td><%=RS("Field6")%></td>
       </tr>

   <%
   RS.MOVENEXT
   WEND
   %>

</table>


To do the sizing of the table cells, use style sheets - its much easier.
<head>
<style type="text/css">
   td {height: 30px; width: 100px;}
</style>
</head>
0
 

Author Comment

by:dereksheahan
ID: 16638986
Hi Rouchie,
I'm using PHP 5, I wonder is it a similar syntax. Sorry, forgot to mention that :)
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 16639129
Well... the style sheet is the same ;-D

I'd wait for jason1178 to take a look.  He's the pro with PHP!
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 

Author Comment

by:dereksheahan
ID: 16639236
Thanks Rouchie, I'll start on the style sheet so!!
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1600 total points
ID: 16641350
Rouchie,  

Wow.  Thanks for the praise...

I'd like to take this moment to thank all of the little people who made this possible. <crickets>

Okay, back to Derek.

When you say each cell contains one field, three cols and vary rows to the end of the query results, do you mean the field is the same (like a cell phone) each time and you want the repeat region to go horizontal first then vertical?

If so, this is called horizontal looping and it isn't the easiest thing to do by hand.  Fortunately, Tom Muck of DW team is a nice guy and has written a free behavior for this for both PHP and ASP.  Read the tutorial and then download the behavior at the bottom of the page:

http://www.tom-muck.com/extensions/help/HorizontalLooper/

It's super simple to use.
0
 

Author Comment

by:dereksheahan
ID: 16641398
Yes, thats exactly what I mean. Thanks Jason, I'll check out that behaviour when I get back from break :)
0
 

Author Comment

by:dereksheahan
ID: 16643909
Brilliant! Got that working spot on!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question