Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    echoing out my php - pls help

    Code:
    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)

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    So whats the problem? What have you tried? Its not that hard to do
    PHP Code:
    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. 
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Apr 2007
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Yeah, you can just concatenate the strings, or print some html/css with it:
    PHP Code:
    print "<div class = \"classname\"><p class = \"classname\">" $KeywordsInUse "(" $KeywordCount ")" "</p></div>"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •