【发布时间】:2015-03-18 18:27:17
【问题描述】:
我目前正在学习 SQL。在我的 CFM 页面上,我输入了教授给我们的所有信息。我什至与其他学生进行比较,试图找出问题所在,但他们的页面看起来像我的。请帮我弄清楚我做错了什么。谢谢。
这是网页链接http://pretendcompany.com/jaedenemployees.html
错误:
第 66 行第 32 列的 72777A 不是有效的标识符名称。 CFML 编译器正在处理:CFOUTPUT 标记的正文开始于行 62,第 3 栏。
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="YOUR NAME HERE" />
<title>USU MIS 2100</title>
<style type="text/css" media="all">
td {
align:center;
width:955;
border:none;
text-align:center;
vertical-align:top;
height:40px;
}
table.center{
margin:auto;
}
h1{
font-size:26px;
color:#001F3E;
}
h2{
font-size:20px;
color:#ffffff;
}
img{ text-align:center;
}
td.photo{
margin:auto;
}
</style>
</head>
<body>
<table class="center">
<tr>
<td ><img src="images/header2_usu.jpg" width="755" height="265" alt="usu" /></td>
</tr>
<tr>
<td style="height:900;background-color:#D7D9D9;padding-top:50px;">
Employees by Department at Pretend Company, Inc.</font></p>
<h1>Jaeden Harris</h1>
<CFQUERY name="jaeden" datasource="employeedatasource">
select Accounting,Administrative,Advertising,Payroll,Sales
from employees
where DepartmentName in(#PreserveSingleQuotes(form.SelectDepts)#)
</CFQUERY>
<!--Place opening CFOUTPUT here -->
<CFOUTPUT query="jaeden">
<table style="width:500;border:none;" class="center">
<tr style="background-color:#72777A;">
<td colspan="2"><h2> #DepartmentName# Employees </h2></td>
</tr>
<tr>
<td style="width:250;text-align:left;">Employee:#FirstName# #MiddleName# #LastName#
<p>Title: #Title#
<p>Email: #EmailName# @pretendcompany.com
<p>Contact Number: #WorkPhone#
</p>
</td>
<td style="width:140px;vertical-align:middle;" class="photo"><!--Reference Photograph field here --> </td>
</tr>
</table>
</CFOUTPUT>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
【问题讨论】:
-
您的页面是 HTML 文件,而不是 CFM。我会从那里开始。
-
感谢您的关注,我完全按照她给我们的基本文件的方式下载了它,并且一直在使用 notepad++ 进行编辑,它具有 CFM 扩展名。
-
什么没有处理?查询没有被执行吗? cfoutput 标签中的错误?
-
您在 CFOUTPUT 中,因此任何带有 # 符号的内容都会被评估,包括样式
background-color:#72777A;。要么使用双重哈希转义那些:background-color:##72777A;,要么将样式移出 CFOUTPUT。 -
与您的老师可能告诉您的相反,我强调功能而不是形式。换句话说,我首先让我的所有数据和其他编程代码工作,然后再担心显示代码。在这个问题的情况下,我看到一个关于 sql 和 cfml 的主题行和问题描述,然后是一堆 css。我停止阅读。太多的谷壳掩盖了小麦。
标签: sql ms-access coldfusion