I fixed a lot of this since I posted it this morning. Now all
that isn't working properly is the select, it isn't passing the
proper variable to make the query work.
This is what I have now:
Page 2:
<CFQUERY name="getProjects"
datasource="#APPLICATION.dataSource#">
SELECT Projects.ProjectID, Projects.Name, Projects.Body,
Projects.CategoryID,
Categories.CategoryID AS catID, Categories.Name AS cat_name
FROM Projects
INNER JOIN Categories
ON Categories.CategoryID = Projects.CategoryID
WHERE Projects.CategoryID = #categoryID#
ORDER BY ProjectID
</CFQUERY>
<!--- I will add the <cfqueryparam> in a bit --->
<cfif getProjects.recordCount is 0>
No projects in this category.
<cfabort>
</cfif>
<!--- This query populates the select nav --->
<CFQUERY name="cata"
datasource="#APPLICATION.dataSource#">
select Name, MYFile, Description, CategoryID
FROM Categories
</CFQUERY>
<head>
<script language="Javascript">
function changeRecord(){
document.category.submit();
}
</script>
</head>
<body>
<!--- this output works well now, gives me what I need and
changes when you select a category from page 1 --->
<cfoutput query="getProjects"
maxrows="1">#cat_name#</cfoutput>
<!-- the select isn't passing the CategoryID properly, it
is now throwing an error --->
<form Name="category" method="post"
Action="portfolio-detail.cfm?CategoryID=#CategoryID#">
<select name="CategoryID" size="1"
onChange="category.submit();">
<option value=""> --Select a Category--
</option>
<CFOUTPUT query= "cata">
<option value="#CategoryID#">#Name#</option>
</CFOUTPUT>
</select>
</form>
<!-- the rest of the code goes after this, it ias all
working --->
The error I get when using the select is this:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in query expression 'Projects.CategoryID ='.
The error occurred in C:\Websites\folio\portfolio-detail.cfm:
line 12
10 : INNER JOIN Categories
11 : ON Categories.CategoryID = Projects.CategoryID
12 : WHERE Projects.CategoryID = #categoryID#
13 : ORDER BY ProjectID
14 : </CFQUERY>
I also tried doing it this way:
<form Name="category" method="post"
Action="portfolio-detail.cfm?CategoryID=true"
This way didn't work at all, it only made the numbered nav on
the page cycle through all the projects in all the categories.
What do I need to change to pass the proper variable from the
select nav to the innerjoin query and my where statement?