Hello everyone, there is a difficulty. I need to make categories, or rather, they already exist, but I don’t know how to get everything out correctly! Arrays? Here there is a category table and there is a topic table, its fields:

 id author title tags date text img cat 

cat - there are indicated the category id in the category table, and the category contains

 id name meta_k meta_d 

So I do not even know how to implement this? There is something like this, if in the topic table the cat field contains 3, then from the category table we take the 3rd entry, where the category name is.

    1 answer 1

    Read about JOIN in mysql. The request in general should be of the form:

     SELECT * FROM topic t JOIN category c ON t.cat = category.id