I have this table where in it store the score and based on each category. The data store in this format, "_bestscore_category1_user1", the title of the stats, the name of the category, and the user. As you can see they are delimited by underscore.
Table
----------------------------------------
User | Score
_bestscore_category1_user1 | 10
_bestscore_category1_user2 | 20
_bestscore_category2_user2 | 20
_bestscore_category2_user1 | 5
So the problem is that, Im trying to query the field based on the user, my sql statement is like this.
SELECT meta_value from wp_postmeta WHERE meta_key REGEXP '_bestscore_([^=])_". $user."'
As you can see we have variable $user which is dynamic, trying this sql, gives me a null output. I wonder if my sql is incorrect, I did try to validate it, but null is the value I'm getting. Any idea?
Note: SQL statement, is not related to the table,
_bestscore_([^_]*)_