这让我现在快疯了。
我的查询忽略了 WHERE 子句,只输出所有结果。
我知道它仍在阅读脚本,因为当我将脚本更改为诸如 WHERE user=xxx 之类的荒谬内容时会引发错误。
帮助?
$data = mysql_query(
"SELECT
tbl_messages.id as msgID,
tbl_messages.from_user as msgFROM,
tbl_messages.to_user as msgTO,
tbl_messages.the_message as msgMESSAGE,
tbl_messages.status as msgSTATUS,
tbl_messages.date as msgDATE,
tbl_messages.subject as msgSUBJECT,
tbl_users.id as usrID,
tbl_users.name as usrNAME,
tbl_photos.profile as photosPROFILE,
tbl_photos.photo_link as photoLINK,
tbl_photos.default_photo as photoDEFAULT
FROM tbl_messages
LEFT JOIN tbl_users
ON tbl_messages.from_user = tbl_users.id
LEFT JOIN tbl_photos ON tbl_photos.profile = tbl_users.id
WHERE tbl_messages.to_user = 65 AND tbl_photos.default_photo IS NULL OR tbl_photos.default_photo = '1'
ORDER BY status DESC")