Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

Searching for hashtags in text field using active record?

$
0
0
Hi!

I have a table that is used to store user_posts. It has a text field called content (TEXT). Users can post #hashtags #our #cool.

I'm trying to run a database search using active record to find the specific hashtags.

When I run:

PHP Code:
$this->db->like("content""#cool")->get("user_posts"); 

It doesn't correctly return all posts with the #cool, but instead all posts containing a #. I ran the query in PhpMyAdmin and it worked perfectly fine.

When I run $this->db->last_query(); it outputs pretty much the same SQL:

Code:
SELECT * FROM user_posts WHERE content LIKE '%#cool%' ESCAPE '!'

Does anyone have any experience with what could be causing this issue?

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>