I have a PHP page and try to list my block categories with names instead of id's.
Here is my MariaDB output:
select id,name from url_category_data;
+----+----------------------+
| id | name |
+----+----------------------+
| 1 | adv |
| 2 | aggressive |
| 3 | alcohol |
| 4 | anonvpn |
| 5 | automobile/bikes |
| 6 | automobile/boats |
| 7 | automobile/cars |
| 8 | automobile/planes |
| 9 | chat |
| 10 | costtraps |
+----+----------------------+
I feed my block list by using those categories and stores as id. Here is my block category list:
select policyid,category_list from url_category_block where status = 1 ;
+----------+---------------+
| policyid | category_list |
+----------+---------------+
| 1 | 8,9,10 |
+----------+---------------+
When I try to use echo I can print out 8,9,10
<p> Result is:
<?php
if($result_block===true || $row_list = $result_block->fetch_assoc()){
echo $row_list["category_list"];}?>
</p>
Its output il like that:
Result is: 8,9,10
But I want to display name of these values, such as;
Result is :
automobile/planes
chat
costtraps
To show my data, I show list as shortly.
Actually there are nearly 150 category name and id. So, I have to automate this match process in PHP
I saw some answer this kind of question, but I am not very familiar with MySQL and PHP, so those answers not clear for me.
How can convert those id numbers to print to screen their names by using PHP?