LOOP

Post Reply
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

LOOP

Post by gaurav.shetti »

I had a small clarification regarding this piece of code.

consider an exmaple like this

<sql max=500 skip=0 "select xyz from abc where a=b">
<if $loop lt 10>
do some processing
<else>
do absolutely nothin
</if>
</sql>

results found is : $loop + 1


I queried the texis and got a count for the records returned from the above query. It was 17500 approx.
Now since i do max=500, the above code shd do some processing for 10 records and for remanining 490 records it shd do nothing. $loop shd be 499 in the end.
But $loop is being returned as 20. Why is the loop stopping after 20 results.


What i am tending to do is doing the count manually instead of using count query, since count query is taking too much time to run as there are many clauses in the where condition. Can you please help me explain the above case which i have mentioned.
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

LOOP

Post by gaurav.shetti »

just a small change ..
its sql row .. instead of just sql
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

LOOP

Post by John »

Do you actually have code in the else where you say "do absolutely nothin"? If there is code it may be setting $loop.
John Turnbull
Thunderstone Software
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

LOOP

Post by gaurav.shetti »

No there is no code. absolutely nothing
User avatar
mark
Site Admin
Posts: 5514
Joined: Tue Apr 25, 2000 6:56 pm

LOOP

Post by mark »

$loop should be the number of matches or 500, whichever is less.

What's between
</sql>
and
results found is : $loop

Is that really your query or are you doing a likep? If so have you changed likeprows? Or any other settings that may be limiting the number of results?
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

LOOP

Post by gaurav.shetti »

oh yes . you are right. There is a condition which is setting the likeprows to around 20. thanks.
Post Reply