How to remove from the database in the column xfields only the word after |label| they are not present in all cells.
These I cells with such content audio|name.mp3||image|name.jpg||wave|name.jpg||data|06.03.2017||label|Vision
or
audio|name.mp3||image|name.jpg||wave|name.jpg||data|06.03.2017
or
audio|name.mp3||image|name.jpg||wave|name.jpg||label|Vision
It should look like this:
Vision - 50 tracks
Spinnin - 35 tracks
Sony - 20 tracks
....
We do this in order, this code displays all the fields xfields
audio|name.mp3||image|name.jpg||wave|name.jpg||data|06.03.2017||label|Vision
etc. How to deduce from this line only the word Vision ? And count in how many cells is it present?
<?php if(!defined('DATALIFEENGINE')) { die("Hacking attempt!"); } global $config; $limit = $limit ? intval($limit) : "20"; if (!$r_short) { $sql = $db->query("SELECT * FROM " . PREFIX . "_post ORDER BY id DESC LIMIT 0,{$limit}"); while ($row = $db->get_row($sql)) { $r_short .= "<p>{$row['xfields']}</p>"; } } echo $r_short; ?> PS
I made that only these words were output, which after label| . Now it is necessary that the repeated words be counted, and no void is displayed, if there is no label| .
<?php if(!defined('DATALIFEENGINE')) { die("Hacking attempt!"); } global $config; $limit = $limit ? intval($limit) : "20"; if (!$r_short) { $sql = $db->query("SELECT * FROM " . PREFIX . "_post ORDER BY id DESC LIMIT 0,{$limit}"); while ($row = $db->get_row($sql)) { echo '<p>'; echo explode('label|', $row['xfields'])[1]; echo '</p>'; } } echo $r_short; ?> 