如何在MySQL中获取查询的特定值。
我的代码:
$q = mysqli_query("SELECT * FROM tb_post WHERE post LIKE '%#%'");
while($d = mysqli_fetch_array($q))
{
$post = $d['post'];
}
示例数据结果如下:
I'm groot #me
What are you doing #what
Sometimes I felt like superman #me
I don't know what to do #confuse
现在,我的问题是:是否可以获得标签?示例:#me,#what,#confuse。 所以我不需要其他价值。
请帮忙!
答案 0 :(得分:0)
这应该适合你:
$post = $d['post'];
$whatIWant = substr($post, strpos($post, "#") + 1);
echo "#" . $whatIWant . "<br />";
输出:
#me
#what
#me
#confuse