gpt4 book ai didi

mysql - 如何在查询字段时使用 strip_tags

转载 作者:行者123 更新时间:2023-11-29 21:58:04 24 4
gpt4 key购买 nike

我在函数中编写了以下查询:

 $dsearch=mysql_real_escape_string($condition['title']);
"select id, title , category, little, strip_tags('description') AS strip_desc,flag ,
POSITION('$dsearch' IN title) AS pos_title,
POSITION('$dsearch' IN strip_desc) AS pos_desc,
from tbl_contents
where title RLIKE '[[:<:]]".$dsearch."[[:>:]]'
or
description RLIKE '[[:<:]]".$dsearch."[[:>:]]'
order by priority desc"

但是“strip_tags”不起作用并且我收到错误。这个查询的方法是不是错了?提前感谢您的帮助。

最佳答案

MySQL 不提供名为 strip_tags 的函数。
假设您使用 PHP 访问数据库,则可以在提取的每一行上使用 PHP 函数 strip_tags:

$strip_desc = strip_tags($row['description']);

看这里:
What is the MySQL query equivalent of PHP strip_tags?

关于mysql - 如何在查询字段时使用 strip_tags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32931089/

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