【发布时间】:2017-03-19 07:56:33
【问题描述】:
我写了这个函数来检索基于 STRPOS 的统计中记录的网站链接的主页,但是 Medoo 抛出了一个错误。
function getSiteAuthor($string) {
if ($string) {
$result = db::query("SELECT id, http FROM users WHERE (strpos(http, '$string') != false) ");
foreach ($result as $row) {
return $row['id'];
}
}
}
http 可能是“http://example.com”,而 $string 可能是“http://example.com/somePage/”。所以我正在寻找包含在 $string
中的 http 的位置错误是“strpos not found in table”。
这可以使用 strpos 完成,还是应该使用 LIKE,如果可以,如何编码。
【问题讨论】:
标签: medoo