样式结果为PHP / HTML

时间:2014-03-17 12:26:50

标签: php html mysql css

我想知道是否有人可以告诉我如何设置从数据库输出到我的php页面的结果。

<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/reset.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container2">

<div id="adminpanel">Admin Page 

<div id="showorders"><u>Orders</u></div>

<?php
session_start();
include('connection.php');

$result = mysql_query("SELECT * FROM orderform");
while($row = mysql_fetch_array($result))
  {
  echo $row['product'] . " " . $row['productcomments'] . " " . $row['name'] . " " . $row['address'] . " " . $row['age'] . " " . $row['delivery'] ;
  echo "<br>";
  }
?>


<div id="showreviews"><u>Reviews</u></div>

<?php


$result = mysql_query("SELECT * FROM reviewform");
while($row = mysql_fetch_array($result))
  {
  echo $row['name'] . " " . $row['product'] . " " . $row['comment']  ;
  echo "<br>";
  }
?>




</div>

更新编码为12.37。需要摆脱订单div中的错误

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

<?php
session_start();
include('connection.php');

$resultOrder = mysql_query("SELECT * FROM orderform");
while($row = mysql_fetch_array($result))
{
echo "<span style='color: #333; width: 200px; height: 200px; padding: 5px; border: 1px solid #ff9900;'>" . $row['product'] . " " . $row['productcomments'] . " " . $row['name'] . " " .       $row['address'] . " " . $row['age'] . " " . $row['delivery'] . "</span>" ;
echo "<br>";
}


$resultReview = mysql_query("SELECT * FROM reviewform");
while($row = mysql_fetch_array($result))
{
echo "<span style='color: #333; width: 200px; height: 200px; padding: 5px; margin-bottom: 20px; border: 1px solid #ff9900;'>" $row['name'] . " " . $row['product'] . " " . $row['comment'] . "</span>" ;
echo "<br>";
}
?>

你真的应该在你的主要样式表中设置你的盒子样式,然后给它们一个DIV ID或CLASS。