Question About While Function »  Show posts from    to     

Icy Phoenix


English Chit Chat - Question About While Function



KugeLSichA [ Wed 03 Feb, 2010 02:37 ]
Post subject: Question About While Function
Hi!

Can someone of you explain me the difference between this two functions and which should i use in standard?

Code: [Hide] [Select]
if ($row = $db->sql_fetchrow($result))
{
$i = 0;
do
{
// php funcs

$template->assign_block_vars('iprow', array());

$i++;
}
while ($row = $db->sql_fetchrow($result));
}


Code: [Hide] [Select]
while ($row = $db->sql_fetchrow($result))
{
// php funcs

$template->assign_block_vars('iprow', array());

$i++;
}


Thanks!


Informpro [ Wed 03 Feb, 2010 11:12 ]
Post subject: Re: Question About While Function
The do{}while(); execute one time at least.


KugeLSichA [ Wed 03 Feb, 2010 12:32 ]
Post subject: Re: Question About While Function
Thanks! Informpro

now i also found the function on php.net.... yesterday i cant find it

http://www.php.net/manual/en/control-structures.do.while.php


Informpro [ Wed 03 Feb, 2010 15:26 ]
Post subject: Re: Question About While Function
It's not a function ...


Mighty Gorgon [ Thu 04 Feb, 2010 00:49 ]
Post subject: Re: Question About While Function
I would use the WHILE.

Anyway it's a matter of personal taste.


Informpro [ Thu 04 Feb, 2010 11:18 ]
Post subject: Re: Question About While Function
Yes, but you're right: while is better, we don't rewrite the $sql->fetch_rowset, DRY :p


KugeLSichA [ Fri 05 Feb, 2010 01:39 ]
Post subject: Re: Question About While Function
ok thank you guys




Powered by Icy Phoenix