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?