PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE tableee ( `id` INTEGER, `tag` VARCHAR(21) ); INSERT INTO tableee (`id`, `tag`) VALUES ('1', 'wordpress, psd , html'), ('2', 'wordpress, html'), ('3', 'wordpress'), ('4', 'psd');
Copy Clear
Copy Format Clear
<?php $query = mysqli_query($mysqli, "SELECT tag FROM tableee "); $array2=array(); while($row=mysqli_fetch_assoc($query)) { $array = explode("," ,$row['tag']); for($i = 0; $i<count($array); $i++) { array_push($array2, trim ($array[$i]) ); } } print_r( array_count_values($array2) ) ;
Show:  
Copy Clear