Jump to content

[SOLVED] tagcloud help


engelsol

Recommended Posts

$tags = "engel,Martin Torrijos,engel,engel,pizza,pizza,house,pizza,Martin Torrijos,house,order,now,order,Martin Torrijos,pizza,margarita,salami,salami,Martin Torrijos,pizza,hot,hot,steamy,hot,taste,quick,love,sexy,love,yummie,pizza,pizza,margarita,salami,expensive";

 

I have this tags list in the about format to populate a tagcloud.  Now I want to generate that tag list dinamically from a tag table.

 

tag table field:

tagid

tagname

 

 

        $q  = "SELECT tagname FROM tagcodes ";
        $tags_index_query = mysql_query($q);
        while ($row = mysql_fetch_array($tags_index_query ))
        {	
        what goes here ?
}	

 

 

Engel

Link to comment
Share on other sites

for example

in the tags table this are the current tags

 

engel,Martin Torrijos,engel,engel,pizza,pizza,house,pizza,Martin Torrijos,house,order,now,order,Martin Torrijos,pizza,margarita,salami,salami,Martin Torrijos,pizza,hot,hot,steamy,hot,taste,quick,love,sexy,love,yummie,pizza,pizza,margarita,salami,expensive

 

here they are separated by comma. but in the db table each one is a record...

 

for my php tagcloud script I can populate the tag cloud manually putting all tag I want separated by a comma...

now I just need to do this automatically. 

 

 

I need to construct some query so that I can get something like:

 

$tags = "all tags separated by a comma";

 

I dont know how to build that part.

 

Engel

Link to comment
Share on other sites

Why don't you just store all the tags in an array, would that work? They would all be separated, and easy to access.

 

<?php

$query = mysql_query("SELECT tagname FROM tagcodes");

while ($row = mysql_fetch_assoc($query)){
   $tags[] = $row['tagname'];
}

echo '<pre>';
  print_r($tags);
echo '</pre>';


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.