我有一个数据库,我想在一个表中显示两列。
我有以下代码但是,这不起作用,我得到
"; } mysqli_close($con); as my answer.[solved after removing echo "<br />"]
代码如下:
<html>
<style>
div.transbox
{
width:850px;
height:500px;
margin:30px 50px;
background-color:#ffffff;
border:1px solid black;
opacity:0.9;
padding: 20px;
filter:alpha(opacity=60); /* For IE8 and earlier */
}
ul#navigation
{
link-style: none;
padding: 5px 20px 5px 20px
margin: 0;
}
ul#navigation li
{
display: inline;
}
h1#heading
{
color:#ffffff;
background-color:#000000;
text-decoration:none;
font-family:georgia, times, serif;
font-size:2em;
padding:10px;
border-bottom:3px solid #ff6600;
}
ul#navigation a {
color:#ffffff;
background-color:#000000;
text-decoration:none;
font-family:georgia, times, serif;
font-size:1.126em;
padding:10px;
border-bottom:3px solid #ff6600;}
div.line
{
display: inline;
}
ul#navigation a:hover {
color:#000000;
background-color:#ff6600;
padding:10px;
border-bottom:3px solid #000000;}
</style>
<head><h1 id="heading">Food Review </h1>
<ul id="navigation">
<li><a href="form4.html">Review</a></li>
<li><a href="Ratings.html">Ratings</a><li>
</ul>
</head>
<body background = img.jpg>
<div class="transbox">
<div class="work">
<?php
define('DB_NAME','form');
define('DB_USER','root');
define('DB_PASSWORD','toor');
define('DB_HOST','localhost');
$link = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
if(!$link)
{
die('could not connect : ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME,$link);
if(!$db_selected)
{
die('Can\'t use ' .DB_NAME . ': ' .mysql_error());
}
$result = mysqli_query($link,"SELECT fname,Ratings from demo1");
while($row = mysqli_fetch_array($result))
{
echo $row['fname']." ".$row['Ratings'];
}
mysqli_close($link);
?>
</div>
</div>
</body>
</html>
}
我做了以下更改,但仍然没有显示结果。