我是 PHP 新手,我正在尝试使用 PHP 构建网站。我有 localhost 来测试结果,并且我已经在网站上安装了 phpmyadmin。
我现在要做的是从数据库“门户”中列出我的表“属性”的内容,并用结果填充一个表。
我正在使用mysqli_query
,mysqli_fetch_array
和 while 循环。我收到以下错误:
警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,布尔值在 C:\xampp\htdocs\falcon\portal\forms\edit Listing.php 第 15 行给出
session_start();
require_once "connect_to_mysql.php"; // where i store username and password to access my db.
$sqlCommand = "SELECT * property FROM portal"; // dbname: portal - table: propery
$query = mysqli_query($myConnection, $sqlCommand);
$Displayproperty = '';
while ($row = mysqli_fetch_array($query))
$id = $row["pid"];
$title = $row["ptitle"];
$area = $row["parea"];
$city = $row["pcity"];
$Displayproperty .= '<table width="500" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>' . $id . '</td>
<td>' . $title . '</td>
<td>' . $area . '</td>
<td>' . $city . '</td>
<td><a href="forms.php?pid=' . $id . '">Upload images</a><br /></td>
</tr>
</table>';