• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

put query iresults n tables and columns

New Here ,
May 08, 2006 May 08, 2006

Copy link to clipboard

Copied

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>
TOPICS
Advanced techniques

Views

808

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , May 09, 2006 May 09, 2006
Grab an HTML manual, in the meantime change

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

for gridlines around everything

Votes

Translate

Translate
Mentor ,
May 08, 2006 May 08, 2006

Copy link to clipboard

Copied

Ever try CFGRID?

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

thanks

CFGRID or Give your table a border attribute:?

How? Where do I put the code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

Grab an HTML manual, in the meantime change

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

for gridlines around everything

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 10, 2006 May 10, 2006

Copy link to clipboard

Copied

<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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 10, 2006 May 10, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 10, 2006 May 10, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 11, 2006 May 11, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 08, 2006 May 08, 2006

Copy link to clipboard

Copied

Give your table a border attribute.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2006 May 11, 2006

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation