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
Version 7.7.5 Images suddenly not displaying
by Stovebolt - 05/04/2024 11:19 AM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
Who's Online Now
1 members (Ruben), 1,101 guests, and 206 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)