...

View Full Version : echoing out my php - pls help



jarv
06-30-2008, 01:34 PM
while ($row3 = mysql_fetch_array($result4))
{
$KeywordsInUse = $row3['keyword'];
$KeywordCount = $row3['keywordCount'];
echo $KeywordsInUse;
echo $KeywordCount;
}

my code above currently displays a list of keywords used like below:

Activism5Artwork2Children2CondomsContra1Drug&AlcoholUse2Education3Healthcare1History1HIV-positive3Orphans2People6Prevention2Projects2

I would like to tidy this, maybe add a class from my CSS layit out better such as:

Activism(5) Artwork(2) Children(2)

_Aerospace_Eng_
06-30-2008, 01:53 PM
So whats the problem? What have you tried? Its not that hard to do

while ($row3 = mysql_fetch_array($result4))
{
$KeywordsInUse = $row3['keyword'];
$KeywordCount = $row3['keywordCount'];
$Keywords .= $KeywordsInUse.'('.$KeywordCount.') ';
}
echo trim($Keywords); // this removes the last space on the end.

Derek Zoolander
06-30-2008, 08:42 PM
Yeah, you can just concatenate the strings, or print some html/css with it:


print "<div class = \"classname\"><p class = \"classname\">" . $KeywordsInUse . "(" . $KeywordCount . ")" . "</p></div>";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum