addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Comma Separated String No Separate?

From: max s.
Sent on: Wednesday, July 20, 2016, 4:46 PM
So i’m trying to create a little string of comma separated link/tags.

I’m sure it’s very simple but i’m just missing whatever it is that i’m doing wrong. Hopefully someone on the list can spot this one easy (I’m making my own forums software for the heck of it - i’m reaching a bit based on my skill, but hey i have the summer and nothing really on to watch right?)

Thanks everyone






while($row = mysqli_fetch_assoc($result))
{# process each row

$threadID = (int)$row['ThreadID'];


$str .=  '<div class="panel panel-default”>
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-' . $threadID . '">' . $row['ThreadTitle'] . ' </a>
</h4>
</div>
<div id="collapse-' . $threadID . '" class="panel-collapse collapse">
<div class="panel-body">
<p>'. $row['ThreadSummary'] . '
<br />';

#set ground work for tags
$charTag = $row['CharTag'];
$arrTags = explode(' - ', $charTag); #should explode string which is comma separated list of numbers into an array to process into a bunch of tags… doesn’t. weird.

#$arrTags var_dump example:
array (size=1)
  0 => string '1,3,6,7,12,22' (length=13)
#is a string of comma separated numbers instead of an array of numbers :(

#if we have tags show them
if (isset($charTag)){
$str .= '<span class="glyphicon glyphicon-tag"></span> ';

$x = 0;
$tot = count($arrTags);

#make links, comma seperated
foreach($arrTags as $key => $value)
{
$str .=  '<a href="../characters/profile.php?CodeName=CodeName&id=' . $value . '&act=show"  target="_blank"> CharacterName-' . $value . '</a> --- ';
}

}

$str .=  '<a class="pull-right" href="'. THIS_PAGE . '&act=showThread&id=' . $threadID . '" target="_blank"> <span class="glyphicon glyphicon-share"></span> Go To Thread</i></a></p>
</div>
</div>
</div>';
}

People in this
group are also in: