Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jan 2005
Posts: 6
F
stranger
stranger
F Offline
Joined: Jan 2005
Posts: 6
I have a question regarding output from loops. I have tried several ways to get my output to display properly within a content island but have yet had any success. Here is my code which outputs my data. When run independently it displays properly, but I can not get it to display in a content box.

Code
$data = mysql_query($query, $link);

while ($row = mysql_fetch_row($data))
	{
		echo "<h6>";
		foreach ($row as $field)
			{
				echo "$field<br>";
			}
		echo "</h6>";
	}
;

If I enter $field between the EOF in the content island, I only get the last field assigned. I have tried assigning the entire while statement, as well as the foreach to a variable but they both throw errors such as unexpected while or foreach. I know there has to be a way but I'm probably not seeing the trees for the forest. Any help is greatly appreciated. Thanks.

Joined: Jan 2005
Posts: 6
F
stranger
stranger
F Offline
Joined: Jan 2005
Posts: 6
Never mind. I figured it out.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
8.0.1 Patch Changelog Discussion
by isaac - 11/26/2025 1:34 PM
Upgraded to ver8 - now can't login
by phoenix011235 - 10/24/2024 8:50 AM
Who's Online Now
0 members (), 407 guests, and 105 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)