Database Display - How can I repete the rows both ways?

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Database Display - How can I repete the rows both ways?

    I am able to display my database on my webpages either all vertically one after
    another ( after using the repete region feature ) or all Horizontally - What i
    want to do is my data to be displayed horizontally in my table ( 3 spaces )
    and then go down to the next row and then display 3 more and then same thing
    over and over ??? can anyone help me>

    heartless Guest

  2. Similar Questions and Discussions

    1. how to display data in 3 columns by 4 rows format
      All, I will be eternally greatful if someone can provide snippet of code, URL or reference material that shows how to display data in a "n...
    2. PHP database site - lots of files!! - Any better ways?
      Hi, im writing my first proper PHP site for ordering services online. The problem I'm finding is that I am ending up with loads of different...
    3. Display 1 data row as multiple datagrid rows
      If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is...
    4. Display SQL rows by certain field?
      I have a SQL database that contains the fields "author," "title," and "category." I want to create a web page that sorts the entries by...
    5. Skript problem / display in 3 rows
      Hi, if a problem wiht the folowing script. i would like to diplay the results in tree rows, and i have no idea where to do this in the script. I...
  3. #2

    Default Re: Database Display - How can I repete the rows bothways?

    You need to create a table that will contain three cells per row. Run a
    counter to let you know when you have written the third cell, then create a new
    row. See concept code below.

    <CFQUERY NAME="getStuff" ... >
    SELECT foo FROM myTable WHERE ...
    </CFQUERY>

    <!--- initialize the cell counter --->
    <CFSET i = 0>
    <TABLE>
    <CFOUTPUT QUERY="getStuff">
    <CFIF i MOD 3 IS 0>
    <TR>
    </CFIF>
    <TD>#foo#</TD>
    <CFSET i = i + 1>
    <CFIF i MOD 3 IS 0>
    </TR>
    </CFIF>
    </CFOUTPUT>
    </TABLE>

    jdeline Guest

  4. #3

    Default Re: Database Display - How can I repete the rows bothways?

    Right general idea but the specifics need a bit of work. First, you can use
    the currentrow variable to decrease the amount of code you use.

    More importantly, you have to make sure you always have an opening <tr> tag,
    so it goes before the cfouput tag. Plus you have ensure you always have a
    closing tag.

    Something like
    <table><tr>
    <cfoutput query ="abc">
    <td>#xyz#</td>
    <cfif currentrow mod 3 is 0>
    </tr><tr>
    <cfif>
    </cfoutput>
    </tr>
    </table>

    Dan Bracuk Guest

  5. #4

    Default Re: Database Display - How can I repete the rows bothways?

    Thank you both! I will Try thsi and let you know how i did ....
    :-)
    heartless Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139