PDA

View Full Version : container for FOR LOOP



Rockstar
January 14th, 2005, 12:40 PM
Hi

I have this code, and you notice there is a FOR LOOP, I want to be able to show the result inside $content [see: I WANT TO INSERT IT HERE]

How do you do that?



for ($i=1; $i<$num_page;$i++){
echo ($i . "&nbsp;");
}'


while ($row = mysql_fetch_array($query_result)) {

$content .="
<div class=\"blogLCSubject\">I WANT TO INSERT IT HERE</div>";

Hans Kilian
January 14th, 2005, 12:55 PM
I'm a bit unclear as to what you're trying to accomplish so I apologise if I've misunderstood you. But maybe this is what you're looking for:

$container = "";
for ($i=1; $i<$num_page;$i++){
$container .= $i . "&nbsp;";
}
echo $container;

Rockstar
January 14th, 2005, 12:59 PM
wow thats a very quick response, thanks Hans
oh actually i edited my post :)
but Ill try your that first.

Thanks Hans

Rockstar
January 14th, 2005, 01:02 PM
oh an it works, but I was wandering even though its working.. am I doing it in the right way? or is there a better way of doing this?