9 Replies Latest reply on May 11, 2006 1:56 PM by kejones

    put query iresults n tables and columns

    kellyhondalovesmusic
      hello , i have this query and should display
      but i need it to be in a cells like rows and columns . just like a ecxel spread sheet but only in html.

      here is the code.
      what do i have to add to make this happen?
      thanks in adv


      <cfquery name="GetCompanies"
      datasource="#Request.MainDSN#">
      SELECT
      CompanyID,
      CompanyName,
      Address,
      City,
      State,
      ZipCode,
      Comments
      FROM
      Company
      ORDER BY
      CompanyName ASC
      </cfquery>

      <html>
      <head>
      <title>ColdFusion MX Bible</title>
      <link rel="stylesheet" href="styles.css">
      </head>

      <body>

      <h1>Company List</h1>

      <table>
      <tr>

      <td><b>ID</b></td>
      <td><b>Name</b></td>
      <td><b>Address</b></td>
      <td><b>City</b></td>
      <td><b>State</b></td>
      <td><b>ZIP Code</b></td>
      <td> </td>
      </tr>
      <cfoutput query="GetCompanies">
      <tr>

      <td>#CompanyID#</td>
      <td>#CompanyName#</td>
      <td>#Address#</td>
      <td>#City#</td>
      <td>#State#</td>
      <td>#ZipCode#</td>
      <td>
      <a href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
      <a href="CompanyAddForm.cfm">Add</a>
      <a href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
      <a href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
      </td>
      </tr>
      </cfoutput>
      </table>

      </body>
      </html>
      ---
      when it is displayed it is like
      Company List
      ID Name Address City State ZIP Code
      27 555k ddd ddd dd 90556 Employees Add Edit Delete
      26 555k ddd ddd dd 90556 Employees Add Edit Delete
      31 dd dd dd dd 89995 Employees Add Edit Delete
      23 ddd ddd ddd dd 90556 Employees Add Edit Delete
      22 ddd ddd ddd dd 90556 Employees Add Edit Delete
      24 ddd ddd ddd dd 90556 Employees Add Edit Delete
      21 mama 252 los angeles ca 90056 Employees Add Edit Delete
      14 Ma's Homemade Pies 5332 Courtland Court Abilene AL 29555 Employees Add Edit Delete
      25 nknknk ddd ddd dd 90556 Employees Add Edit Delete
      15 Normwelland and Drake Clothing Co. 1240 Pierpont Point Boston MA 02134 Employees Add Edit Delete
      16 Pizza Palace 1548 High Point Freeway New York NY 00248 Employees Add Edit Delete
      29 qqqq 888 laverne za 90000 Employees Add Edit Delete
      30 qqqq 888 laverne za 90000 Employees Add Edit Delete

      13 The Very Big Corporation of America 5806 Glenn Hollow Lane Norcross GA 30071 Employees Add Edit Delete
      -----------------------
      without the cells/records>
        • 1. Re: put query iresults n tables and columns
          paross1 Level 2
          Ever try CFGRID?

          Phil
          • 2. Re: put query iresults n tables and columns
            Dan Bracuk Level 5
            Give your table a border attribute.
            • 3. Re: put query iresults n tables and columns
              kellyhondalovesmusic Level 1
              thanks

              CFGRID or Give your table a border attribute:?

              How? Where do I put the code?
              • 4. Re: put query iresults n tables and columns
                JMGibson3 Level 1
                Grab an HTML manual, in the meantime change

                <table> to <TABLE width=100% align="left" border="4" rules="all">

                for gridlines around everything
                • 5. Re: put query iresults n tables and columns
                  kellyhondalovesmusic Level 1
                  <cfquery name="GetCompanies"
                  datasource="#Request.MainDSN#">
                  SELECT
                  CompanyID,
                  CompanyName,
                  Address,
                  City,
                  State,
                  ZipCode,
                  Comments
                  FROM
                  Company
                  ORDER BY
                  CompanyName ASC
                  </cfquery>

                  <html>
                  <head>
                  <title>ColdFusion MX Bible</title>
                  <link rel="stylesheet" href="styles.css">
                  </head>

                  <body>

                  <h1>Company List</h1>

                  <TABLE width=100% align="left" border="4" rules="all">
                  <tr>

                  <td><b>ID</b></td>
                  <td><b>Name</b></td>
                  <td><b>Address</b></td>
                  <td><b>City</b></td>
                  <td><b>State</b></td>
                  <td><b>ZIP Code</b></td>
                  <td> </td>
                  </tr>
                  <cfoutput query="GetCompanies">
                  <tr>

                  <td>#CompanyID#</td>
                  <td>#CompanyName#</td>
                  <td>#Address#</td>
                  <td>#City#</td>
                  <td>#State#</td>
                  <td>#ZipCode#</td>
                  <td>
                  <a href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
                  <a href="CompanyAddForm.cfm">Add</a>
                  <a href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
                  <a href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
                  </td>
                  </tr>
                  </cfoutput>
                  </TABLE>

                  </body>
                  </html>
                  ------------------------------

                  thanks i did but the out put is still the same


                  Company List
                  ID Name Address City State ZIP Code
                  26 555k ddd ddd dd 90556 Employees Add Edit Delete
                  27 555k ddd ddd dd 90556 Employees Add Edit Delete
                  31 dd dd dd dd 89995 Employees Add Edit Delete
                  22 ddd ddd ddd dd 90556 Employees Add Edit Delete
                  23 ddd ddd ddd dd 90556 Employees Add Edit Delete
                  24 ddd ddd ddd dd 90556 Employees Add Edit Delete
                  21 mama 252 los angeles ca 90056 Employees Add Edit Delete
                  14 Ma's Homemade Pies 5332 Courtland Court Abilene AL 29555 Employees Add Edit Delete

                  but still
                  its not in cells
                  • 6. Re: put query iresults n tables and columns
                    paross1 Level 2
                    What does this look like?

                    <cfquery name="GetCompanies"
                    datasource="#Request.MainDSN#">
                    SELECT
                    CompanyID,
                    CompanyName,
                    Address,
                    City,
                    State,
                    ZipCode,
                    Comments
                    FROM
                    Company
                    ORDER BY
                    CompanyName ASC
                    </cfquery>

                    <html>
                    <head>
                    <title>ColdFusion MX Bible</title>
                    <link rel="stylesheet" href="styles.css">
                    </head>

                    <body>

                    <h1>Company List</h1>

                    <cfform name="dummy" method="POST">
                    <center>
                    <cfgrid name="out_grid" query="GetCompanies">
                    <cfgridcolumn name="CompanyID" width="100">
                    <cfgridcolumn name="CompanyName" width="100">
                    <cfgridcolumn name="Address" width="100">
                    <cfgridcolumn name="City" width="100">
                    <cfgridcolumn name="State" width="100">
                    <cfgridcolumn name="ZipCode" width="100">
                    </cfgrid>
                    </center>
                    </cfform>

                    </body>
                    </html>

                    Phil
                    • 7. Re: put query iresults n tables and columns
                      kellyhondalovesmusic Level 1
                      thanks

                      it looks like

                      Company List
                      ID Name Address City State ZIP Code
                      26 555k ddd ddd dd 90556 Employees Add Edit Delete
                      27 555k ddd ddd dd 90556 Employees Add Edit Delete
                      31 dd dd dd dd 89995 Employees Add Edit Delete
                      22 ddd ddd ddd dd 90556 Employees Add Edit Delete
                      23 ddd ddd ddd dd 90556 Employees Add Edit Delete
                      24 ddd ddd ddd dd 90556 Employees Add Edit Delete
                      21 mama 252 los angeles ca 90056 Employees Add Edit Delete
                      14 Ma's Homemade Pies 5332 Courtland Court Abilene AL 29555 Employees Add Edit


                      without the cels and grids
                      • 8. Re: put query iresults n tables and columns
                        paross1 Level 2
                        You must have something else going on in your page to be suppressing your table and grid information. Are you sure that you are running the modified code and not your original? If you are using CFGRID and not seeing a grid, then you have other problems.

                        Phil
                        • 9. Re: put query iresults n tables and columns
                          kejones
                          Does your stylesheet do something funky with the table, tr, or td elements? The code looks fine. I just tested this on my system against Northwind database, and it works fine.

                          Kris