Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中的动态表_Php_Sql_Dynamic_Html Table - Fatal编程技术网

PHP中的动态表

PHP中的动态表,php,sql,dynamic,html-table,Php,Sql,Dynamic,Html Table,以下代码工作正常,并提供所需的输出: <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:itali

以下代码工作正常,并提供所需的输出:

<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>

属性类型:'$正确的类型。”
BHK:'$bhk
状态:'$地位。”
地点:'$洛克。”
建筑物名称:‘$建筑名称。”
楼层数目:‘$不在地板上。”
地毯面积:'$地毯区。”
建筑面积:'$“你的地盘。”
价格:'$价格选择
联络人:‘$联系人。”
但我需要把这个放在桌子上。我正在使用以下代码:

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>";
echo”
建筑位置BHKS建筑区域提供“万斯租赁停车场”;
foreach($行作为$行){
echo“$the_row->buildingname.”;
回显“$the_row->loc.”;
回声“$the_row->bhk.”;
回声“$the_row->building_area.”;
echo“$the_row->interior_options_select.”;
回声“$the_row->price.”;
echo“$the_row->advrent.”;
回显“$the_行->存款”;
回声“$the_row->car_parking.”;
}
回声“;

但这并不是从数据库中获取结果。非常感谢您的帮助。

如果您使用的是简单的mysql\u query()和mysql\u fetch\u 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>";
echo”
建筑位置BHKS建筑区域提供“万斯租赁押金停车场”;
foreach($行作为$行){
回显“$the_行['buildingname']”;
回显“$the_行['loc']”;
回显“$the_row['bhk']”;
回显“$the_row['Building_area'”;
回显“$the_行['interior_options_select']”;
回显“$the_行['price'”;
回显“$the_行['advrent']”;
回显“$the_行[“存款]”;
回声“$the_row['car_parking'”;
}
回声“;

如果不超过,请也描述您的数据库代码,

哪里是
$the_rows
defined?(定义的行),以便根据右侧的列获取行中的数据。但是您在哪里做
$the_rows=
?我不太擅长数据库查询。你能解释一下我需要采取的步骤吗?这个网站更多的是关于你遇到的错误/问题的问题,而不是一个教程“向我展示代码”网站。你可能想从某个地方的在线教程开始。只需搜索“php sql查询教程”和“如何在本地设置sql数据库”,确保教程在去年发布,以获得最佳结果