That loop will never end. Generally, the loop body should manipulate
some part of the loop ending condition.
initialize $i before the loop
replace the second loop with "if($prescene2==0){$i++;}"
Chakravarthy K Sannedhi wrote:
>
> hi all,
>
> when i am trying to calculate the number of rows with a '0' in a
> particular column using the following code, it is giving the 'Maximum
> execution time exceeded' message, eventhough after i gave
> set_time_limit(60), it didn't worked, infact now it is even worse the
> browser is getting siezed.
>
> $result=mysql_query("select * from mytable");
> while ($avgrow=mysql_fetch_array($result))
> {
> $prescene2 = $avgrow["scene2"];
> $prescene4 = $avgrow["scene4"];
> $prescene5 = $avgrow["scene5"];
> $prescene7 = $avgrow["scene7"];
> $prescene8 = $avgrow["scene8"];
> $prescene9 = $avgrow["scene9"];
> $i = 1;
> while ($prescene2 == 0) {
> $i=$i+1;
> }
> }
> printf ("Number of zeros=%d",$i);
>
> Can any one please help me with this.
>
> TIA
> kalyan
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]