所以我有一个有趣的问题。我有两个 userId 和 contractId 数组,我想比较它们以查看是否有任何结果匹配。然后只显示不匹配的。任何帮助,将不胜感激。
//select all users and contracts possibilities
$rQ = "SELECT users.userId AS userId, cId AS contractId, name, cTitle FROM contracts, users WHERE users.roleId = contracts.roleId ORDER BY users.userId ASC ";
$rR = mysql_query($rQ);
$a = mysql_fetch_assoc($rR);
//selects current signatures in signatures table
$rQ1 = "SELECT userId, contractId FROM signatures ORDER BY userId ASC ";
$rR1 = mysql_query($rQ1);
$a1 = mysql_fetch_assoc($rR1);
示例:如果
$a['userId'] != $a1['userId'] && $a['contractId'] != $a1['contractId']
然后
echo $a['name'] . $a['cTitle']