2014-05-07 28 views
-1

我正在嘗試使用PHP查詢MSSQL表,它將查找具有不等於某個值的列的行。我目前正在使用這個如何使PHP/SQL查詢選擇列不等於變量的行

$selecting6 = "select * from used_trailers1 where photo1='".$picature2."' or photo='".$picature2."' or name='".$picature2."' or photo2='".$picature2."' or photo3='".$picature2."' or photo4='".$picature2."' and Orderid isnot '".$id."'"; 

無濟於事,這個代碼是行不通的。

什麼正確的代碼可以用來選擇不具有值$id的行?

謝謝你的幫助。所有的幫助表示讚賞。

回答

1

試試這個

$selecting6 = "select * from used_trailers1 where (photo1='".$picature2."' or photo='".$picature2."' or name='".$picature2."' or photo2='".$picature2."' or photo3='".$picature2."' or photo4='".$picature2."') and Orderid !='".$id."'"; 
+0

我接受你的答案,因爲我第一次使用它,它的工作原理。 – Kelsey

+0

@凱爾西很高興你的問題修復了 – shatheesh