Reputation: 41
I'm trying to create duplicate div
s with different data in each obtained from a SQL database. I have the code creating the div
s and populating the correct fields with the correct data, but my code is nesting the div
s 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>";
}
?>
Upvotes: 1
Views: 3046
Reputation: 7956
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>";
Upvotes: 1
Reputation: 619
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>";
}
?>
Upvotes: 3