Answered
Number nav for viewing records
Hello;
I created a numbered navigation for cycling through DB records. When I created it, it was based on catagoryID. There were a number of catagories and this would put a navigation under the records like this:
1 | 2 | 3| more> The word Previuos would appear if you got into the records. The nav will also grow automatically if the records grew, (more we added)
Now I am changing things on this "app" I am not using catagories, but want it to just cycle through the records placing 10 records on the page at a time, and only using the ID from teh DB records to cycle through. I changed the code and it is erroring out on me now. Here is the code I am using:
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="PageNum_GetRecord" default="1">
<cfquery NAME="tracking" datasource="#sitedatasource#" username="#siteUserID#" password="#sitePassword#">
SELECT ID, REMOTE_ADDR, HTTP_USER_AGENT, TRACK_DATE
FROM tracking
WHERE ID = #ID#
ORDER BY ID
</cfquery>
<cfparam name="startRow" default="1">
<cfparam name="maxRows" default="10">
<cfset numRows = tracking.recordCount>
<cfif startRow gt numRows><cfset startRow = Max(startRow-maxRows,10)></cfif>
<cfset endRow = Min(Evaluate(startRow + maxRows - 10),numRows)>
<body>
<cfoutput query="tracking" STARTROW="#StartRow#" maxRows="#maxRows#">
#all my output is in here#
</cfoutput>
<cfmodule
template="../CFdocs/pageNav.cfm"
totalItems="#numRows#"
numPerPage="#maxRows#"
startRow="#startRow#"
url="#cgi.script_name#?ID=#ID#&startRow=#startRow#">
My error is the following:
Variable ID is undefined.
The error occurred in C:\websites\108392zj7\admin\tracking.cfm: line 7
5 : <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
6 : <cfparam name="PageNum_GetRecord" default="1">
7 : <cfquery NAME="tracking" datasource="#sitedatasource#" username="#siteUserID#" password="#sitePassword#">
8 : SELECT ID, REMOTE_ADDR, HTTP_USER_AGENT, TRACK_DATE
9 : FROM tracking
Can anyone help me figure out what it is I am missing and why my ID is not difined?
Thank you
Phoenix
I created a numbered navigation for cycling through DB records. When I created it, it was based on catagoryID. There were a number of catagories and this would put a navigation under the records like this:
1 | 2 | 3| more> The word Previuos would appear if you got into the records. The nav will also grow automatically if the records grew, (more we added)
Now I am changing things on this "app" I am not using catagories, but want it to just cycle through the records placing 10 records on the page at a time, and only using the ID from teh DB records to cycle through. I changed the code and it is erroring out on me now. Here is the code I am using:
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="PageNum_GetRecord" default="1">
<cfquery NAME="tracking" datasource="#sitedatasource#" username="#siteUserID#" password="#sitePassword#">
SELECT ID, REMOTE_ADDR, HTTP_USER_AGENT, TRACK_DATE
FROM tracking
WHERE ID = #ID#
ORDER BY ID
</cfquery>
<cfparam name="startRow" default="1">
<cfparam name="maxRows" default="10">
<cfset numRows = tracking.recordCount>
<cfif startRow gt numRows><cfset startRow = Max(startRow-maxRows,10)></cfif>
<cfset endRow = Min(Evaluate(startRow + maxRows - 10),numRows)>
<body>
<cfoutput query="tracking" STARTROW="#StartRow#" maxRows="#maxRows#">
#all my output is in here#
</cfoutput>
<cfmodule
template="../CFdocs/pageNav.cfm"
totalItems="#numRows#"
numPerPage="#maxRows#"
startRow="#startRow#"
url="#cgi.script_name#?ID=#ID#&startRow=#startRow#">
My error is the following:
Variable ID is undefined.
The error occurred in C:\websites\108392zj7\admin\tracking.cfm: line 7
5 : <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
6 : <cfparam name="PageNum_GetRecord" default="1">
7 : <cfquery NAME="tracking" datasource="#sitedatasource#" username="#siteUserID#" password="#sitePassword#">
8 : SELECT ID, REMOTE_ADDR, HTTP_USER_AGENT, TRACK_DATE
9 : FROM tracking
Can anyone help me figure out what it is I am missing and why my ID is not difined?
Thank you
Phoenix