trouble with while loop and ul/li style

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

trouble with while loop and ul/li style

Post by danwguy »

So I have a script that queries the db and returns all the info, it should be displaying it as ul/li and it almost works right but there are some problems. here's the code...

Code: Select all

<div id="fees">
		<h1>Current Fee list</h1>
		
			<?php
				$fee = mysql_query("SELECT * FROM fees");
					if(!$fee) {
						$error = "Sorry could not select the fee schedule: " .mysql_error();
						}
					if($error !='') {
						echo "Sorry could not complete, we must exit and try again<br />";
						echo $error;
						exit();
						} else {
							while($row = mysql_fetch_assoc($fee)) {
								echo "<ul>" .$row['name'];
								echo "<li> Price </li>";
								echo "<ul>";
								echo "<li> $" .$row['price']. ".00</li>";
								echo "</ul>";
								if($row['date'] == '' || $row['date'] == 'NULL') { } else {
								echo "<li> Date </li>";
								echo "<ul>";
								echo "<li>" .$row['date'];
								echo "</ul>";
								}
								echo "<li> Additional Information</li>";
								echo "<ul>";
								echo "<li>" .$row['comments']. "</li>";
								echo "</ul>";
								echo "</ul>";
								}
							}
					?>
				</div>
it outputs the info but it looks like this...
Application Fee
•Price
◦$150.00•Additional Information
◦For international students
The CSS doesn't look like there is any problems in it... here's the CSS for that part...
[text]#fees {
width: 1000px;
float: left;
height: 415px;
text-align: center;
font-family: MyriadPro-Regular;
font-size: 16px;
}

#fees ul {
float: left;
align: left;
text-align: left;
font-size: 18px;
font-family: MyriadPro-Regular;
font-style: bold;
margin-left: 10px;
}

[/text]
I can't seem to figure out why the "Additional information is displaying next to the price, it should be below it. Any help please, Thank you.
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: trouble with while loop and ul/li style

Post by fugix »

What are the errors that you receive?
Post Reply