Note that there are some explanatory texts on larger screens.

plurals
  1. POweird while($tag = mysqli_fetch_assoc()
    text
    copied!<p>I have a weird problem. i fetch some rows from database using:</p> <pre><code>while($tag = mysqli_fetch_assoc($tags)) { $return['threads'][] = "&lt;a id='showtag' href='answer.php?view=tag&amp;id=" . $tag['id'] . "&amp;name=" . $tag['name'] . "'&gt;" . $tag['name'] . "&lt;/a&gt;&lt;a class='addtag' id='" . $tag['id'] . "' href=''&gt; +&lt;/a&gt;&lt;br /&gt;"; } </code></pre> <p>this should provide 2 links (one for entering the tag, and one + for adding the same tag to favourite list).</p> <p>then i simply wants to display them.</p> <pre><code>foreach($return['threads'] as $key1) { print_r($key1); } </code></pre> <p>but what i get is:</p> <pre><code>linux + mac + </code></pre> <p>looks great so far. 'linux' links to:</p> <pre><code>answer.php?view=tag&amp;id=131&amp;name=linux </code></pre> <p>but the problem is that the + sign to the right links to:</p> <pre><code>answer.php?view=tag&amp;id=77&amp;name=mac </code></pre> <p>and 'mac' links to</p> <pre><code>answer.php?view=tag&amp;id=131&amp;name=mac </code></pre> <p>while + sign:</p> <pre><code>answer.php?view=tag&amp;id=77&amp;name=mac </code></pre> <p>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</p> <pre><code> ...&lt;/a&gt;&lt;/a... to &lt;/aa </code></pre> <p>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.</p> <p>what could the problem be?</p> <p>any idea?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload