THank You Jon,  I am trying some of what other's here on the list suggested
also.

Michael


"Jon Hall" <[EMAIL PROTECTED]> wrote in message
028701c0ad91$fd121de0$a41f88d8@ns2">news:028701c0ad91$fd121de0$a41f88d8@ns2...
> Mike do a little debugging on the host. What is the value of #nextid# and
> #previd# on the page? When you click next on the host, does it show the
> first record everytime? Does the url always say default2.cfm?ID=2  ?
> If so, it's obvious that the sql statement is not picking up the url
> variable and probably is only picking up the cfparam variable.
>
> Try scoping your variables just to make sure. If this isn't the problem it
> is always a good idea to scope variables, it makes the code a little
easier
> to read later on, and it executes faster.
>
>
> <cfparam name="url.id" default="1">
>
> <cfquery name="selectcandidate" datasource="interview" maxrows=1
> dbtype="ODBC">
> SELECT      ID, EmpCandidate, SKillBackground, Status, Recruiter, Profile
> FROM        interview
> WHERE ID=#url.id#
> </cfquery>
>
> <cfset nextid = url.id + 1>
> <cfset previd = url.id - 1>
>
> Notice no pound signs within the cfsets, it is again easier to read and
> executes slightly faster.
>
> One problem I see is that you are relying the ID to be sequential in the
> database. If you delete a record, eventually you will run into a query
that
> has no record and shows a blank page.
> I think a better way to do all this if the user does not have the ability
to
> edit records, would be to cache the query and use startrow and maxrow in
> your cfoutput. Like so...
>
> <cfparam name="url.id" default="1">
>
> <cfquery name="selectcandidate" datasource="interview" dbtype="ODBC"
> cachedwithin="#CreateTimeSpan(0,0,0,10)#">
> SELECT      ID, EmpCandidate, SKillBackground, Status, Recruiter, Profile
> </cfquery>
>
> <cfset nextid = url.id + 1>
> <cfset previd = url.id - 1>
>
> <cfoutput query="selectCandidate" startrow="#url.id" maxrows="1">
> Data here
>
> <td align="left"><a href="default2.cfm?ID=#PrevID#">Previous</a></td>
> <td align="right"><a href="default2.cfm?ID=#NextID#">Next</a></td>
> </cfoutput>
>
> This will work even without caching, but might as well make it quicker.
>
>
> jon
> ----- Original Message -----
> From: "Mike" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, March 15, 2001 1:59 PM
> Subject: Code review PLEASE
>
>
> > This is really making me go bald,  I have a page that has next and
> previous,
> > and when viewed locally I can see everything, when I ftp to my host (and
> yes
> > the odbc is working and correct) I can only see the first record, and
> > nothing after that.
> >
> > I have tried putting the database(access) in the database folder, and
> > straight in the directory with all the pages and I still get the same
> > result, I have replaced the database, and contacted my host, and they
say
> > that the code is fine from what little the guy knew about CF.
> >
> > Below is the code if someone could share there knowledge I would as
always
> > appreciate it.
> >
> > And thank you
> >
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
> >
> > <HTML>
> > <HEAD>
> > <CFPARAM Name="ID" Default=1>
> >
> > <cfquery name="selectcandidate" datasource="interview" maxrows=1
> > dbtype="ODBC">
> > SELECT      ID, EmpCandidate, SKillBackground, Status, Recruiter,
Profile
> > FROM        interview
> > WHERE ID=#ID#
> > </cfquery>
> >
> > <CFSET NextID=#id#+1>
> > <CFSET PrevID=#id#-1>
> >
> > <TITLE>Interview Candidates</TITLE>
> > </HEAD>
> >
> > <BODY bgcolor="6699ff">
> > <!--- include toolbar.cfm--->
> > <cfinclude template="Toolbar.cfm">
> >
> > <cfoutput query="Selectcandidate">
> > <table cellpadding="10">
> > <tr>
> >  <td>ID</td><br>
> >  <td>#id#</td><br>
> > </tr>
> > <tr>
> >  <td>Candidate Name</td><br>
> >  <td>#EmpCandidate#</td><br>
> > </tr>
> > <tr>
> >  <td>Skill Background</td>
> >  <td>#SKillBackground#</td>
> > </tr>
> > <tr>
> >  <td>Status</td>
> >  <td>#Status#</td>
> > </tr>
> > <tr>
> >  <td>Recruiter</td>
> >  <td>#Recruiter#</td>
> > </tr>
> > <tr>
> >  <td valign="top">Profile</td>
> >  <td><textarea cols="50" rows="5"
name="Profile">#profile#</textarea></td>
> > </tr>
> > </table>
> > <BR><BR>
> > <table width="85%" border="0">
> > <TR>
> > <TD align="left"><a href="default2.cfm?ID=#PrevID#">Previous</a></TD>
> > <td align="right"><a href="default2.cfm?ID=#NextID#">Next</a></td>
> > </td></TR></table>
> > </cfoutput>
> >
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to