1

I'm trying to create duplicate divs with different data in each obtained from a SQL database. I have the code creating the divs and populating the correct fields with the correct data, but my code is nesting the divs within each other.

<?php
$query = mysql_query("SELECT id, name, location, amountRequested FROM     fundable");

while ($temp = mysql_fetch_array($query)) {
echo "<div class='widgetLoan'>";
echo "<div class='title'><h6>".$temp['name']."</h6><span class='widgetLoanCat'>Category</span>";
echo "<div class='num'><a href='#' class='blueNum'>".$temp['amountRequested']."</a></div>";
echo "</div>";
}
?>
1
  • 3
    You're not closing the "title" div Commented Aug 25, 2012 at 18:41

3 Answers 3

3

Try this :

<?php
$query = mysql_query("SELECT id, name, location, amountRequested FROM     fundable");

while ($temp = mysql_fetch_array($query)) {
echo "<div class='widgetLoan'>";
echo "<div class='title'><h6>".$temp['name']."</h6><span class='widgetLoanCat'>Category</span></div>";
echo "<div class='num'><a href='#' class='blueNum'>".$temp['amountRequested']."</a></div>";
echo "</div>";
}
?>
Sign up to request clarification or add additional context in comments.

1 Comment

You have no idea how long I have been Staring at this, thanks for your help!
1

you forgot to close a </div> tag

change

echo "<div class='title'><h6>".$temp['name']."</h6><span class='widgetLoanCat'>Category</span>";

for

echo "<div class='title'><h6>".$temp['name']."</h6><span class='widgetLoanCat'>Category</span></div>";

1 Comment

You have no idea how long I have been Staring at this, thanks for your help!
0

Looks like you are missing a </div> tag to me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.