PHP & MySQL how to display data question

Kroll42

New Member
I want to be able to display my posts tags array \[code\][0] => grill [1] => meat [2] => hot-dogs\[/code\] with a comma separating each tag and was wondering how can I do this using PHP?Stored in the database.\[code\]$page_tags = Array ( [0] => grill [1] => meat [2] => hot-dogs ) \[/code\]Desired output.\[code\]grill, meat, hot-dogs\[/code\]Here is the PHP & MySQL code.\[code\]$page_tags = array();$dbc = mysqli_query($mysqli,"SELECT tags.*, posts_tags.* FROM tags INNER JOIN posts_tags ON tags.id = posts_tags.tag_id WHERE posts_tags.post_id= '" . $pageID . "' AND posts_tags.user_id = '" . $userID . "' GROUP BY tags.tag");if (!$dbc) { print mysqli_error($mysqli);} else { while($row = mysqli_fetch_array($dbc)){ $page_tags[] = $row['tag']; }}\[/code\]
 
Back
Top