I would like to create a system to issue opinions on a given thing. I'm at a good point, but I can not get created for each element taken from the database a correspond div. Let me explain, for example if I have three reviews made by the three authors, I would like three divs for the reviews, and three for the authors, then automatically generated by the loop. How can i do?
2
-
I do not get your question properly... Do you want to display $Feedback,$UserNick and $UserMail inside html div tag?A.M.N.Bandara– A.M.N.Bandara2013-11-30 14:10:23 +00:00Commented Nov 30, 2013 at 14:10
-
Hi, no, I want that for every element taken from the database is automatically created a div.Mario G.– Mario G.2013-11-30 14:11:30 +00:00Commented Nov 30, 2013 at 14:11
Add a comment
|
1 Answer
You can do this.. First of all add <body> tag to your html document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
$Content = mysql_query("SELECT * FROM feedback");
while($Row = mysql_fetch_array($Content)) {
$Feedback = $Row['FeedbackUser'];
$UserNick = $Row['UserNickname'];
$UserMail = $Row['UserEmail'];
echo "<div>{$Feedback}</div>"; // Displaying feedback as div
echo "<div>{$UserNick }</div>"; // Displaying UserNick as div
echo "<div>{$UserMail }</div>"; // Displaying UserMail as div
}
?>
</body>
Hope this is what you are looking for