【发布时间】:2016-10-25 05:40:41
【问题描述】:
以下代码运行良好,并提供所需的输出:
<a target="_blank" href="' . $property_post_link . '" style="color:#f8953a;font-size:18px;margin-left:0px;text-decoration:none"><b>' . $property_name . '</b></a>
<div style="color:#f8953a;font-style:italic">
<!--- <span style="font-weight:bold;">Transaction Type: </span>' . $transaction_type . ' --->
<!--- <span style="font-weight:bold;padding-left:5px;">Category: </span>' . $newprop_category . ' --->
</div>
<div style="color:#f8953a;font-style:italic">
<span style="font-weight:bold">Property Type: </span>' . $proper_type . '
<span style="font-weight:bold;padding-right:5px;">BHK: </span>' . $bhk . '
<span style="font-weight:bold;padding-left:5px;">Status: </span>' . $status . '
</div>
<div style="color:#f8953a;font-style:italic">
<span style="font-weight:bold">Location: </span>' . $loc . '
<span style="font-weight:bold;padding-right:5px;">Building Name: </span>' . $buildingname . '
<span style="font-weight:bold;padding-left:5px;">No. of Floor: </span>' . $no_floor . '
</div>
<div style="color:#f8953a;font-style:italic">
<span style="font-weight:bold">Carpet Area: </span>' . $carpet_area . '
<span style="font-weight:bold;padding-right:5px;">Built up Area: </span>' . $buildup_area . '
<span style="font-weight:bold;padding-left:5px;">Price: </span>' . $price_options_select . '
</div>
<div style="color:#f8953a;font-style:italic">
<span style="font-weight:bold">Contact Person: </span>' . $contactperson . '
</div>
但我需要把它放在一张桌子上。我正在使用以下代码:
echo "<table border='1'>
<tr><th>Building</th><th>Location</th><th>BHKs</th><th>Built up Area</th><th>Furnishing</th><th>Quote</th><th>Advance Rent</th><th>Deposit</th><th>Parking</th></tr>";
foreach ($the_rows as $the_row) {
echo "<tr><td>" . $the_row->buildingname . "</td>";
echo "<td>" . $the_row->loc . "</td>";
echo "<td>" . $the_row->bhk . "</td>";
echo "<td>" . $the_row->buildup_area . "</td>";
echo "<td>" . $the_row->interior_options_select . "</td>";
echo "<td>" . $the_row->price . "</td>";
echo "<td>" . $the_row->advrent . "</td>";
echo "<td>" . $the_row->deposit . "</td>";
echo "<td>" . $the_row->car_parking . "</td></tr>";
}
echo "</table>";
但这不是从数据库中获取结果。任何帮助表示赞赏。
【问题讨论】:
-
$the_rows定义在哪里? -
按列获取行中的数据
-
对。但是你在哪里做
$the_rows = <database query code here>? -
我不太擅长数据库查询。你能解释一下我需要采取哪些步骤吗?
-
这个网站更多的是关于你遇到的错误/问题的问题,而不是一个教程“给我看代码”网站。您可能想从某个地方的在线教程开始。只需搜索“php sql 查询教程”并可能搜索“如何在本地设置 sql 数据库”确保该教程是在去年发布的,以获得最佳效果
标签: php sql dynamic html-table