dongshi3818 2013-05-28 12:50
浏览 30
已采纳

PHP - “通知:未定义的变量:行” - 无法获取MySQL的记录[重复]

this is my first programming question on the internet.

I already made some research, tried to change something, but so far, nothing solved my problem.

I have the code below:

$sql = "SELECT * FROM tb_carros_of";
$result = mysqli_query($con, $sql) or die("Error: ".mysqli_error($con));
while($row = mysqli_fetch_array($result))
{
  echo strtoupper($row['no_escud']);
}

The problem is: the exact code works fine on an external website, but locally, on my computer, it returns the error "Notice: Undefined variable: row" on the line starting with "echo ...";

What am I missing?

</div>
  • 写回答

1条回答 默认 最新

  • doucan9079 2013-05-28 14:48
    关注

    guys! I just found how to solve the problem! Sorry I didn't provide you the wholle code at first. I would do it next time. The problem is that I didn't provide the closing mark ?> at the end of my file. I just did it, and the db records showed up in the browser! Although I don't know how the external website is working without the closing mark.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大