RE: $i vs. $r

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
Does anyone have a clue why using this code doesn't work:

$i = 0;

while ($row = mysql_fetch_array($result))

	{	
		echo ("Blah blah blah");
		$i++;
	}

but this code does?

$r = 0;

while ($row = mysql_fetch_array($result))

	{	
		echo ("Blah blah blah");
		$r++;
	}

I don't use $i anywhere else on the page.
[/snip]

While $i is often used as an iterative (hence $i) variable it is not
required to be $i. You are echoing $r at the end of the while loop,
aren't you? Nothing in the loop requires an $i at this point.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux