Page 1 of 1

LOOP

Posted: Tue Apr 13, 2010 6:26 am
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.

LOOP

Posted: Tue Apr 13, 2010 9:29 am
by gaurav.shetti
just a small change ..
its sql row .. instead of just sql

LOOP

Posted: Tue Apr 13, 2010 9:48 am
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.

LOOP

Posted: Tue Apr 13, 2010 10:37 am
by gaurav.shetti
No there is no code. absolutely nothing

LOOP

Posted: Tue Apr 13, 2010 10:52 am
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?

LOOP

Posted: Tue Apr 13, 2010 10:57 am
by gaurav.shetti
oh yes . you are right. There is a condition which is setting the likeprows to around 20. thanks.