Searching for records in the MySQL database according data after the comma

47
July 12, 2018, at 02:40 AM

I have such MySQL tables

create table items (
id int not null auto_increment,
cats varchar (200) not null,
name varchar (100) not null,
image varchar (200) not null,
url varchar (200) not null,
primary key (id)
) engine = myisam charset = utf8;

in cats I keep category names in the form (pop, rock, dance). I currently have 1.5 million records in the database and I want to add sorting by selected categories to the site. I tried to use the mysql IN function while it does not work correctly, it displays only a few results or not at all

SELECT * FROM items WHERE cats IN ('pop', 'dance', 'rock') ORDER BY id ASC LIMIT 0,20

in order to optimize for the cats field I created an index so the search works quickly. My question: How do I search for all the records in the database according to the data after the decimal in the cats field? in a way that it works properly?

Edit: Categories in the cats field are arranged randomly

READ ALSO
Remove the second instance of a key value pair in a collection

Remove the second instance of a key value pair in a collection

So I am trying to determine if a app is part of a list of apps that are affected by downstream servicesThe following code is what I am currently trying to do:

63
PHP replace web address test in variable

PHP replace web address test in variable

can anyone help with this? I have a web address as a variable and would like to replace multiple web address if they exist

32
Ignore optional parameter in Laravel?

Ignore optional parameter in Laravel?

Currently within my routes file I've got the following Route defined:

75
Laravel: Trying to access value inside array in view template

Laravel: Trying to access value inside array in view template

So I'm trying to access the value of a few pair of key->values inside an array I create and pass to the view called config, I'd like to access to them like this : {{ $config->web_name['value'] }} or {{ $config->$web_name['value'] }} but both are returning...

22