这是一个查找$sql条件的基本查询。
$sql = "SELECT jobs.pickup as myPickup, jobs.dropoff as myDropoff FROM jobs, locality WHERE
locality.pickup=jobs.pickup AND locality.dropOff=jobs.dropoff";
$test= mysqli_query($conn, $sql);
while( $row = mysqli_fetch_assoc($test)) {
echo "Pick up: " . $row["myPickup"]. " to ".$row["myDropoff"]."<br>";
你将如何展示所有失败的价值观。我试过
$row != mysqli_fetch_assoc($test)
//and
while($row = mysqli_fetch_assoc($result) == false)
但似乎没有进展。我还试着用以下代码编辑SQL:
SELECT jobs.pickup as myPickup, jobs.dropoff as myDropoff FROM jobs, locality WHERE locality.pickup!=jobs.pickup AND locality.dropOff!=jobs.dropoff
但这也不起作用,出于某种原因;"与";SQL中的语句";locality.pickup=jobs.pickup AND locality.dropOff=jobs.dropOff";代码就像一个";OR";作用奇怪的
我尝试了"其中NOT";在SQL中,但我不知道您需要添加括号。这就是为什么它的行为不正确
SELECT jobs.pickup as myPickup, jobs.dropoff as myDropoff FROM jobs, locality WHERE NOT (locality.pickup=jobs.pickup AND locality.dropOff=jobs.dropoff);