运行下面的代码时出现上述错误。在更改某些行之前,它完全正常工作,例如变量$appcode
。之前,在我做一些更改之前,我手动定义了$appcode
值。然后我尝试通过从我在上一页中定义的$_SESSION
变量中获取值来自动化该值。
以下是代码,错误陈述位于$res
之后的变量$appcode
。
<?php
session_start();
$con= mysqli_connect("localhost", "root", "");
mysqli_select_db($con, "coba3thesis");
$appcode = $_SESSION['appcode'];
$res = mysqli_query($con, "SELECT * FROM section4 WHERE mod(pictureID, 2) = 0 NOT IN (SELECT pictureID FROM temp_pic WHERE appcode = $appcode) ORDER BY RAND() LIMIT 1");
while($row= $res->fetch_assoc()){
$hetero = $row['hetero'];
$homo = $row['homo'];
$pedo = $row['pedo'];
$picID = $row['pictureID'];
$picname = $row['picturename'];
$desc = $row['description'];
}
?>
感谢您的帮助,感谢您。
答案 0 :(得分:0)
while($row= mysqli_fetch_assoc($res)){
$hetero = $row['hetero'];
$homo = $row['homo'];
$pedo = $row['pedo'];
$picID = $row['pictureID'];
$picname = $row['picturename'];
$desc = $row['description'];
}