Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MYSQL select where字段不包含特定字符串_Php_Mysql_Database_Dynamic_Sitemap - Fatal编程技术网

Php MYSQL select where字段不包含特定字符串

Php MYSQL select where字段不包含特定字符串,php,mysql,database,dynamic,sitemap,Php,Mysql,Database,Dynamic,Sitemap,我使用sql从表中选择我的所有站点URL $sql = 'select * from pages where "myURL field"; 不过,我想对我的查询更具体一点。我的表格中有几个重复链接,例如: about-us ./about-us 我不想选择/about us字段。有没有一种说法: select * where "myURL field" does not begin with . / 或者我应该忘记它并使用PHP进行解析吗 SELECT * FROM pages WHERE

我使用sql从表中选择我的所有站点URL

$sql = 'select * from pages where "myURL field";
不过,我想对我的查询更具体一点。我的表格中有几个重复链接,例如:

about-us
./about-us
我不想选择
/about us
字段。有没有一种说法:

select * where "myURL field" does not begin with . /
或者我应该忘记它并使用PHP进行解析吗

SELECT * FROM pages WHERE some_col NOT LIKE './%';

这将获取某些列未以
/
开头的所有行,在mysql中使用
LIKE
检查它是否以
/
开头。使用下面的代码

SELECT * FROM pages WHERE col_name NOT LIKE './%';

希望这对你有帮助

很好,很好:)
select * from pages where my_url NOT LIKE './%';