php – mysqli_query,mysqli_fetch_array和while循环

前端之家收集整理的这篇文章主要介绍了php – mysqli_query,mysqli_fetch_array和while循环前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是 PHP的新手,我正在尝试使用 PHP构建一个网站.我有localhost用于测试结果,我已经在网站上安装了PHPmyadmin.

我现在要做的是从数据库“portal”列出我的表“property”的内容,并用结果填充表格.

我正在使用MysqLi_query,MysqLi_fetch_array和while循环.我收到以下错误

Warning: MysqLi_fetch_array() expects parameter 1 to be MysqLi_result,
boolean given in C:\xampp\htdocs\falcon\portal\forms\edit listing.PHP
on line 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>';
用此替换您的查询.确保之前已添加此行.
$db = MysqL_select_db('portal');

$sqlCommand = "SELECT * FROM property";

猜你在找的PHP相关文章