php – mysqli_query,mysqli_fetch_array和while循环

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – mysqli_query,mysqli_fetch_array和while循环脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我是 PHP新手,我正在尝试使用 PHP构建一个网站.我有localhost用于测试结果,我已经在网站上安装了PHPmyadmin.

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

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

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 – mysqli_query,mysqli_fetch_array和while循环全部内容,希望文章能够帮你解决php – mysqli_query,mysqli_fetch_array和while循环所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。