我这里有两个查询,$ check_perms和$ get_projects。前者似乎有效,但不是后者。没有错误,只是没有结果,但我知道应该有。
$sessionUser = $_SESSION['user_id'];
$check_perms = $db->prepare("SELECT * FROM tasks WHERE id = ?");
$check_perms->bind_param('i', $par);
if ($result = $check_perms->execute())
if ($row = mysqli_fetch_assoc($result))
if ($row['user'] != $sessionUser){
echo "<container>Error. This is not your task.</container>";
exit;
}
$get_projects = Database::connect()->prepare("SELECT * FROM tasks WHERE user = ? ORDER BY weight DESC");
$get_projects->bind_param('i', $sessionUser);
if ($result = $get_projects->execute())
while ($row = mysqli_fetch_assoc($result))
//stuff
答案 0 :(得分:0)
您确定tasks.user
字段是整数吗?尝试改变:
$check_perms->bind_param('i', $sessionUser);
到
$check_perms->bind_param('s', $sessionUser);