Click to See Complete Forum and Search --> : for loop


Anon
03-08-2002, 05:55 AM
hi,

may be this is a dumb question to ask but here goes anyway..

I have 2 for loops such as:

for(int $i = 0; $i < View.length; $i++) {
for(int $l = 0; 4l <Approve.length ; $l++) {

SQL = "insert into DOC_PRIVILEGES (COD)......

}
}

where view.length = 5 and approve.length is 0 (in this case), how do i
execute my query irrespective of whether the inner forloop is empty or
not???

I cannot use a l"<=" as it wud result in an ArrayOutOfBoundsException...

any suggestions pl??

TIA,
sands

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

vincente
03-11-2002, 07:19 AM
Use an IF statement.
IF approve.length>0 then do the loop, else just do the query.