logged_with_bugmenot Posted July 8, 2007 Share Posted July 8, 2007 Hi, I have following problem for($b=0;$b<$a+1;$b=$b+1) { $item[$b]=new item;////I even initialzed it outside for loop but still problem remains for($i=$itemlevel[$b];$i<$itemlevel[$b+1];$i=$i+1) { //if($item[$b]->title!="") $item[$b]->$title=kazmi("title",$pieces[$i]); if($item[$b]->$title!="")echo $item[$b]->$title"<br>";//It prints here but.... } } echo $item[$b]->$title"<br>";//It is not printing here???????? Can anyone please tell me how to overcome this problem Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 8, 2007 Share Posted July 8, 2007 first use the code brackets secondly your syntax is pretty weak try this: <?php for($b=0;$b<$a+1;$b++) { //Now what do you want to have happen i here? } ?> Quote Link to comment Share on other sites More sharing options...
logged_with_bugmenot Posted July 8, 2007 Author Share Posted July 8, 2007 ok the whole thing is like this: for($b=0;$b<$a+1;$b++) { $item[$b]=new item; for($i=$itemlevel[$b];$i<$itemlevel[$b+1];$i++) { $item[$b]->$title=kazmi("title",$pieces[$i]); } } echo $title[2];///but this is not printing anything but when i tried to print it before closing last 2 brackets, it worked- why it isnt printing here Quote Link to comment Share on other sites More sharing options...
logged_with_bugmenot Posted July 8, 2007 Author Share Posted July 8, 2007 thanks guys , I found the way out following works for($b=0;$b<$a+1;$b=$b+1) { $item[$b]=new item; for($i=$itemlevel[$b];$i<$itemlevel[$b+1];$i=$i+1) { //if($item[$b]->title!="") $temp=kazmi("title",$pieces[$i]); if($temp!="")$item[$b]->$title=$temp; //if($item[$b]->$title!="") //echo $item[$b]->$title.$b."<br>"; } } echo $item[1]->$title; i thank u all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.