gpt4 book ai didi

php - 在 mysql 中搜索 WHERE NOT 函数来查找字符串?

转载 作者:行者123 更新时间:2023-11-29 06:55:59 25 4
gpt4 key购买 nike

我得到以下 Mysql 命令:

// Call on a random style ID to display in rating window which user hasn't seen yet.

$resultSet = $conn->query("SELECT pictureID,userID FROM styles WHERE NOT
viewedByUser = (NOT LIKE '%$userID%') ORDER BY RAND() LIMIT 1");
while($rows = $resultSet->fetch_assoc() ){
$rateableUserID = $rows['userID'];
$rateablePictureID = $rows['pictureID'];
}

我想使用 WHERE NOT 函数在不包含与变量 $userID 相同的字符串的字符串后搜索字段“viewedByUser”。

我在这里有什么选择?

最佳答案

试试这个:-

$resultSet = $conn->query("SELECT pictureID,userID FROM styles WHERE
viewedByUser NOT LIKE '%$userID%' ORDER BY RAND() LIMIT 1");
while($rows = $resultSet->fetch_assoc() ){
$rateableUserID = $rows['userID'];
$rateablePictureID = $rows['pictureID'];
}

关于php - 在 mysql 中搜索 WHERE NOT 函数来查找字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45607436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com