以下代码工作正常,它提供了所需的输出:
<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>";
但这不是从数据库中获取结果。任何帮助表示赞赏。
答案 0 :(得分:0)
如果您使用的是简单的mysql_query()和mysql_fetch_array(),请使用下面的代码。
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>";
如果不是,请同样取消您的数据库代码,