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 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动