本文介绍了PHP/MySQLi-循环运行时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
$v = $conn->query("SELECT * FROM `categories` WHERE `Link`!=''");
while($vrowi = mysql_fetch_array($v, MYSQLI_ASSOC))
{
$url = $vrowi['Link'];
$Cat = $vrowi['id'];
}
while
循环不起作用.你能告诉我错误在哪里吗?预先感谢!
The while
loop isn't working. Can you please tell me where the mistake is? Thanks in advance!
推荐答案
您正在将面向对象的MySQLi代码与一种功能性方法混合在一起,并且需要选择其中一种.确切地说,解决方案是这样的:
You're mixing object-oriented MySQLi code with a functional approach, and need to choose either one or the other. In your exact, the solution is this:
$v = $conn->query("SELECT * FROM `categories` WHERE `Link` != '';");
while ($vrowi = $v->fetch_assoc()) {
$url = $vrowi['Link'];
$Cat = $vrowi['id'];
}
这篇关于PHP/MySQLi-循环运行时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!