水平显示 Mysql table 个结果
Display Mysql table results horizontally
我正在尝试弄清楚如何水平显示 mysql table 结果,例如
http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/agni/guide.html
示例
name 1 name 2 name3
description description description
url url url
这是我用来测试的代码
<?php
if (!$link = mysql_connect('', '', '')) {
echo '700';
exit;
}
if (!mysql_select_db('Radio', $link)) {
echo '701';
exit;
}
$items = 5;
$query = "SELECT * FROM Stations";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
//echo '<table border="1">';
while($row = mysql_fetch_array($result)){
echo "<a href='index.php?date=" . $row[Name] . "' class='link'>$row[Name]</a>";
}//end while loop
echo "</tr>";
echo '</table>';
}else{ echo 'no records found'; }
?>
我似乎无法让它以我想要的方式显示数据 应该更改代码中的哪些内容以使其看起来像上面的示例?
if (!$link = mysql_connect('', '', '')) {
echo '700';
exit;
}
if (!mysql_select_db('Radio', $link)) {
echo '701';
exit;
}
$items = 5;
$query = "SELECT * FROM Stations";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
echo '<table border="1">';
echo '<tr>';
while($row = mysql_fetch_array($result)){
echo '<td>';
echo '<div><a href="index.php?date=' . $row['Name'] . '" class="link">' . $row['Name'] . '</a></div>';
echo '<div>' . $row['description'] . '</div>';
echo '<div>' . $row['url'] . '</div>';
echo '</td>';
}//end while loop
echo '</tr>';
echo '</table>';
} else { echo 'no records found'; }
我正在尝试弄清楚如何水平显示 mysql table 结果,例如 http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/agni/guide.html
示例
name 1 name 2 name3
description description description
url url url
这是我用来测试的代码
<?php
if (!$link = mysql_connect('', '', '')) {
echo '700';
exit;
}
if (!mysql_select_db('Radio', $link)) {
echo '701';
exit;
}
$items = 5;
$query = "SELECT * FROM Stations";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
//echo '<table border="1">';
while($row = mysql_fetch_array($result)){
echo "<a href='index.php?date=" . $row[Name] . "' class='link'>$row[Name]</a>";
}//end while loop
echo "</tr>";
echo '</table>';
}else{ echo 'no records found'; }
?>
我似乎无法让它以我想要的方式显示数据 应该更改代码中的哪些内容以使其看起来像上面的示例?
if (!$link = mysql_connect('', '', '')) {
echo '700';
exit;
}
if (!mysql_select_db('Radio', $link)) {
echo '701';
exit;
}
$items = 5;
$query = "SELECT * FROM Stations";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
echo '<table border="1">';
echo '<tr>';
while($row = mysql_fetch_array($result)){
echo '<td>';
echo '<div><a href="index.php?date=' . $row['Name'] . '" class="link">' . $row['Name'] . '</a></div>';
echo '<div>' . $row['description'] . '</div>';
echo '<div>' . $row['url'] . '</div>';
echo '</td>';
}//end while loop
echo '</tr>';
echo '</table>';
} else { echo 'no records found'; }