We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Loop/Array only displaying first result
Page Index Toggle Pages: 1
Loop/Array only displaying first result (Read 547 times)
Loop/Array only displaying first result
Apr 13th, 2009, 6:31pm
 
Hi guys,

Does anyone know why only the first result of the array is being shown from the code below? If I print to screen, I get a result for my first date but no others.. Sad Thanks for your help in advance. If I hardcode the date instead of daysReport[p] it works fine.

Quote:
        int p = 0;
        while (p < 7){
          msql.query( "SELECT COUNT(*) FROM alertlist WHERE status='UP' AND datetime LIKE '"+daysReport[p]+"%'");
          msql.next();
        
          nodeAvail[p] = msql.getInt(1);      
          rowDayPercentage[p] = (nodeAvail[p] / 1440.0) * 100; 
          UpTimeDisplay[p] = rowDayPercentage[p] * 4.7;
          p = p + 1;
        }

Re: Loop/Array only displaying first result
Reply #1 - Apr 13th, 2009, 11:12pm
 
I guess the issue is more in what the various daysReport[] entries look like... You should println them before the SQL request.
Page Index Toggle Pages: 1