I must be missing something because your question seems to be one that
represents the very thing that ColdFusion was developed to do. Display
records from a database.

Lets start from the beginning. You say you want a dynamic table and from the
rest of the statements it appears that you just want a list of books
returned by the query in a table format.

1. Run a query to retrieve the records:

        <cfquery name="qBooks" datasource="BookDatabase">
        select bookId,title, author
        from Books
        where title like '#form.strLetter#%'
        order by title
        </cfquery>

2. Now build a table that displays the records:

        <table border="1" cellspacing="2" cellpadding="0">
                <tr>
                        <th>Title</th>
                        <th>Author</th>
                </tr>
                <cfoutput query="qBooks">
                <tr>
                        <td><a 
href="BookDetail.cfm?book=#qBooks.bookId#">#qBooks.Title#</a></td>
                        <td>#qBooks.Author#</td>
                </tr>
                </cfoutput>
        </table>

This results in a table that has one row "td" for each book returned by the
query.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of phumes1
Sent: Wednesday, December 05, 2001 6:33 AM
To: [EMAIL PROTECTED]
Subject: Re: Creating table listing from database entries



Hi,

How would I go about creating a dynamic table from entries in my database?

I have book names which I'm pulling from the database and displaying the
results based on where the user clicks on the alphabetical index.

Just for testing I've created a table with ten <td>...</td> for the listing
of all books that start with the letter "A". Other letters have more or
less.

How can I figure out how many books are being pulled from the database and
use that information to create the correct number of <td>...</td> or even
the complete table from the results?


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to