Jump to content

chalrune

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chalrune's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. can a mod please transfer this topic to MySQL Help? i never noticed i was in the wrong part of the forums :-\
  2. well it looks like it didnt work well after all... i still have a problem with the same select statement.. like when i have a bookmark with 2 tags on it, it will echo twice. when there is just one tag it will show just one. i want this end result. 1 unique bookmark with all its tags. (like all bookmark_id get shown once) <?php $result = mysql_query(" SELECT b.bookmark_naam, b.bookmark_url, t.tag_id, t.tag_naam FROM bookmarks b LEFT JOIN bookmarks_tags bt ON bt.bookmark_id = b.bookmark_id INNER JOIN tags t ON t.tag_id = bt.tag_id"); $prevbookmark = ""; while($row = mysql_fetch_assoc($result)) { if($row['bookmark_naam'] != $prevbookmark) { echo "<h2><a href=\"{$row['bookmark_url']}\">{$row['bookmark_naam']}</a></h2>tags: "; $prevbookmark = $row['bookmark_naam']; } echo "<span>"; echo "<a href=\"index.php?t={$row['tag_id']}\">{$row['tag_naam']} </a>"; echo "</span>"; }?>
  3. i have solved my own problem and i am pretty happy about the result. it was the wrong use of the select statement. this is the piece of the code i used for future problem seekers. <?php $result = mysql_query("SELECT b.bookmark_naam, b.bookmark_url, t.tag_id, t.tag_naam FROM bookmarks b LEFT JOIN bookmarks_tags bt ON bt.bookmark_id = b.bookmark_id INNER JOIN tags t ON t.tag_id = bt.tag_id"); $prevbookmark = ""; while($row = mysql_fetch_assoc($result)) { if($row['bookmark_naam'] != $prevbookmark) { echo "<a href=\"{$row['bookmark_url']}\"><h1>{$row['bookmark_naam']}</a></h1>tags: "; $prevbookmark = $row['bookmark_naam']; } echo "<a href=\"index.php?t={$row['tag_id']}\">{$row['tag_naam']} | </a>";/>?>
  4. hello people i hope anyone have some time to help me with this question ok i have three tables [bOOKMARKS] bookmark_id [PRIMARY KEY auto_increment] bookmark_name bookmark_url [TAGS] tag_id [PRIMARY KEY auto_increment] tag_name [bOOKMARKS_TAGS] bookmark_id tag_id the table "bookmarks" are my bookmarks and the table "tags" are the used tags. i want to relate the bookmarks with the tags table using the connection table "bookmarks_tags" $result2 = mysql_query("SELECT tags.tag_id, tags.tag_name FROM tags INNER JOIN bookmarks_tags ON bookmark_id = bookmarks_tags.bookmark_id INNER JOIN tags ON tag.id = bookmarks.tags.tag_id"); while ($row2 = mysql_fetch_array($result2)) { echo "<a href=\"index.php?t={$row2['tag_id']}\">{$row2['tag_naam']}</a>"; } i allready have this but it doesnt work. can anyone help me giving something like this [a bookmark] [all related tags] i hope anyone can help me..
×
×
  • 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.