PHP MySQLi 匹配两个表 ID 然后重定向



我想匹配两个表的 ID,然后如果 ID 匹配,则将其重定向到特定页面。

SELECT user_skill.user_id AS id_one, job_seeker.user_id AS id_two
FROM user_skill 
INNER JOIN job_seeker ON (user_skill.user_id = job_seeker.user_id)

在下面使用此条件

if(mysqli_num_rows($result) > 0) {
    while($fetch = mysqli_fetch_assoc($result)) {
        if($fetch['id_one'] === $fetch['id_two']) {
            header('location: userhome.php');
        }
        else {
            header('location: userskill.php');
        }
     }
}

任何建议都会有所帮助。谢谢!!

SELECT user_skill.user_id AS id_one, job_seeker.user_id AS id_two
FROM user_skill 
INNER JOIN job_seeker ON (user_skill.user_id = job_seeker.user_id)

在下面使用此条件

if(mysqli_num_rows($result) > 0) {
    while($fetch = mysqli_fetch_assoc($result)) {
$variable=array($fetch['id_one']=>$fetch['id_two']);
 foreach($variable as $x=$value)

{ if($x === $value( {

            header('location: userhome.php');
        }
        else {
            header('location: userskill.php');
        }
}
     }
}

最新更新