tags:

views:

55

answers:

2

I have a weird problem. i fetch some rows from database using:

while($tag = mysqli_fetch_assoc($tags))
{
    $return['threads'][] = "<a id='showtag' href='answer.php?view=tag&id=" . $tag['id'] . "&name=" . $tag['name'] . "'>" . $tag['name'] . "</a><a class='addtag' id='" . $tag['id'] . "' href=''> +</a><br />";
}

this should provide 2 links (one for entering the tag, and one + for adding the same tag to favourite list).

then i simply wants to display them.

foreach($return['threads'] as $key1)
{
    print_r($key1);
}

but what i get is:

linux +
mac +

looks great so far. 'linux' links to:

answer.php?view=tag&id=131&name=linux

but the problem is that the + sign to the right links to:

answer.php?view=tag&id=77&name=mac

and 'mac' links to

answer.php?view=tag&id=131&name=mac

while + sign:

answer.php?view=tag&id=77&name=mac

The problem is the + sign. it should just show answer.php (i will couple jquery to its class) because i had nothing in href=''. and not another tag's id. when i delete

 ...</a></a... to </aa

then the problem is gone. but then i had just one link. i want to have one tag link and another link to add the tag link to favourite list.

what could the problem be?

any idea?

+1  A: 

href=''> is the issue in the addtag <a>. I think id=77 is probably showing because you have no href. You need to look at the source to find the problem - the browser will just confuse you if you look at where it's linking to.

Can you show us the source of the generated links?

Skilldrick
what do you mean with source?
weng
Right-click - view source. The actual HTML used to show the page.
Skilldrick
A: 

sorry guys.

i returned to many uneccassary (difficult word to spell) unwanted information from database.

i had

 SELECT *. solved it by
 tags.*
weng