Jump to content

Extract rows from database in a particular order


Waleed-KH

Recommended Posts

Hey guys

If i have a database like this

3753d1366377739-untitled-1.jpg

 

How can I extract items so that after each item is extracted sub​​-items

So the output will be

 

		<ul>
			<li>
				<span>Item 1</span>
			</li>
			<li>
				<span>Item 2</span>
				<ul>
					<li>
						<span>Item 2-1</span>
						<ul>
							<li>
								<span>Item 2-1-1</span>
							</li>
							<li>
								<span>Item 2-1-2</span>
							</li>
						</ul>
					</li>
					<li>
						<span>Item 2-2</span>
						<ul>
							<li>
								<span>Item 2-2-1</span>
								<ul>
									<li>
										<span>Item 2-2-1-1</span>
									</li>
									<li>
										<span>Item 2-2-1-2</span>
									</li>
								</ul>
							</li>
						</ul>
					</li>
				</ul>
			</li>
			<li>
				<span>Item 3</span>
				<ul>
					<li>
						<span>Item 3-1</span>
						<ul>
							<li>
								<span>Item 3-1-1</span>
							</li>
						</ul>
					</li>
					<li>
						<span>Item 3-2</span>
					</li>
					<li>
						<span>Item 3-3</span>
					</li>
				</ul>
			</li>
		</ul>
 
Please answer and thank you :)

Can you reattach the photo of your database? The basic idea is to query the database, loop through the results and echo out the query results inside out the loop along with the HTML you want to output.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.