Page 1 of 1

How do I delete the last echo in a while loop?

Posted: Mon Feb 22, 2010 3:30 pm
by cap2cap10
Hello again, php Technorati. Here is my problem i want to see a number for each time a function is performed.
Hence I did a $count++ and echo $count in a while loop. Now How do I delete the last $count echoed so that I will see numbers that increase, instead of a list of numbers representing each time the function was performed?

Code: Select all

 
While loop;{
 
$count++;
 
echo $count;
 
delete $count?????????????
}
 
Pleas show me the way.

As always, thanks in advance,


Batoe

Many obstacles and obstructions lie in the path, but so does success! The unkown Optimist

Re: How do I delete the last echo in a while loop?

Posted: Mon Feb 22, 2010 4:32 pm
by jraede
You're going to have to explain this a little better...I have no idea what you're trying to do.

Re: How do I delete the last echo in a while loop?

Posted: Mon Feb 22, 2010 5:32 pm
by pickle
It seems like he wants a progress bar-type-thing.

So he sees:

1

then just

2

then just

3

instead of

1 (then a little while later) 2 (then a little while later) 3, resulting in "123"

Short answer - you can't with just PHP. You can, in your function, output Javascript that then acts on the rendered DOM & updates a div's content.