Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

startrow

Status
Not open for further replies.

achai

MIS
May 23, 2000
71
US
I'm trying to write next #maxrows#<br>erro shows:<br>startrow<br>can't convert to data type
 
&lt;cfset maxrows=4&gt;<br>&lt;cfparam name=&quot;start&quot; default=1&gt;<br>&lt;cfparam name=&quot;field1&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;field2&quot; default=&quot;&quot;&gt;<br><br>&lt;cfquery name=&quot;view&quot;....<br>...<br><br>&lt;tr&gt;&lt;cfoutput query=&quot;view&quot; startrow=&quot;#start#&quot; maxrows=&quot;#maxrows#&quot;&gt;&lt;td&gt;#field1#&lt;/td&gt;&lt;/cfoutput&gt;&lt;/tr&gt;<br>&lt;tr&gt;&lt;cfoutput query=&quot;view&quot;&nbsp;&nbsp;startrow=&quot;#start#&quot; maxrows=&quot;#maxrows#&quot;&gt;&lt;td&gt;#field2#&lt;/td&gt;&lt;/cfoutput&gt;&lt;/tr&gt;<br>&lt;cfset prevstart=start-maxrows&gt;<br>&lt;cfset nextstart=start+maxrows&gt;<br>&lt;tr&gt;&lt;td&gt;&lt;cfif prevstart gte 1&gt;<br>&lt;cfoutput&gt;&lt;form action=&quot;thispage.cfm&quot; method=&quot;post&quot;&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;start&quot; value=&quot;#prevstart#&quot;&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;#field1#&quot;&gt;<br>&lt;input type=&quot;submit&quot; value=&quot;previous&quot;&gt;&lt;/td&gt;<br>&lt;td&gt;&lt;cfif nextstart lte view.recordcount&gt;<br>&lt;cfoutput&gt;&lt;form action=&quot;thispage.cfm&quot; method=&quot;post&quot;&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;start&quot; value=&quot;#nextstart#&quot;&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;#field1#&quot;&gt;<br>&lt;input type=&quot;submit&quot; value=&quot;next&quot;&gt;&lt;/td&gt;&lt;/tr&gt;<br>----------------------------------------------<br><br>it shows very well in first page. i want 4 colums in each page. but click &quot;next&quot; button, the next search page shows startrow is wrong.<br><br><br><br><br>
 
For debugging purposes, I'll often output a variable value so I can see what's going on...&nbsp;&nbsp;I can't see a problem with your code (other than the fact that your missing a couple of &lt;/cfif&gt;'s)<br><br>right after your CFQUERY tag,&nbsp;&nbsp;put this (temporarily, of course): &lt;cfoutput&gt;start=#start# maxrows=#maxrows#&lt;/cfoutput&gt; so you can see why CF is choking on this...&nbsp;&nbsp;Everything looks fine, but it looks like your start variable is either less than 1 or not a number at all according to your error message...<br><br>If it ends up that #start# is not a number, it's possible (I didn't check it out, though) that start may be a reserved word, so you may want to try changing the variable name.<br><br>Another possibility:&nbsp;&nbsp;Is 'Start' one of your column names?&nbsp;&nbsp;If so, you may be reading #start# from the query and not from the form field...
 
&lt;cfset prevstart=start - maxrows&gt;<br>&lt;cfset nextstart=start + maxrows&gt;<br>&lt;color purple&gt;&lt;tr&gt;&lt;td&gt;&lt;cfoutput&gt;#nextstart# #maxrows#&lt;/cfoutput&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/color&gt;<br>&lt;tr&gt;&lt;td&gt;&lt;cfif nextstart lte viewiru.recordcount&gt;<br>&lt;cfoutput&gt;&lt;form action=&quot;thispage.cfm&quot; method=&quot;post&quot;&gt;<br>&lt;color purple&gt;&lt;&lt;input type=&quot;text&quot; name=&quot;start&quot; value=&quot;#nextstart#&quot;&gt;&lt;/color&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;#field1#&quot;&gt;<br>&lt;input type=&quot;submit&quot; value=&quot;next&quot;&gt;&lt;/cfoutput&gt;<br>&lt;/cfif&gt;&lt;/td&gt;&lt;/tr&gt;<br>--------------------------------------<br><br>color1: nextstart shows 5<br>color2: nextstart shows nothing. <br>so i think maybe &lt;b&gt;&lt;cfif nextstart lte viewiru.recordcount&gt;&lt;/b&gt; is wrong.<br>
 
start is not a column name, I set it from beginning:<br>&lt;cfparam name=&quot;start&quot; default=&quot;1&quot;&gt;
 
figoured out, nothing is wrong except i wrote &quot;value&quot; wrong. haha.<br>thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top