Answer the question
In order to leave comments, you need to log in
Arrays in php how to solve the problem?
Hi friends, help me solve one problem. There is a mysql database and a genre column
As you can see, in one column there are genres separated by vergule.
When I make selections from the database and form a query into arrays, it forms the entire column for one identifier
How to make each genre have its own identifier
Here is the source code:
$query = "SELECT * FROM torrents";
$sql = $db->query($query);
$arr = $db->get_row($sql)
$genre = $arr['genre'];
print_r(array($genre));
Answer the question
In order to leave comments, you need to log in
1) Normalize the table
2) Use substring_index, and crutches
3) Do the breakdown already in PHP, after the selection. ( $genre = explode(',', $arr['genre']); )
Choose any of the options.
PS
vergole = comma?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question