|
Posted by Brian V Bonini on 06/06/05 00:04
On Sun, 2005-06-05 at 16:37, Jack Jackson wrote:
> This is something dumb I am doing but:
>
> Trying to pull all names of publishers in db. This sql:
>
> SELECT art.art_id,art.publisher_id,publisher.publisher_name,
> FROM art
> LEFT JOIN publisher
> ON publisher.publisher_id=art.publisher_id
>
> pulls (in phpmyadmin) four rows:
> artID pubID Publisher_name
> 1 7 The New York Times: Sunday Styles
> 2 3 The New York Sun
> 3 2 Metro NY
> 4 3 The New York Sun
>
>
> I'm trying to make a sidebar which will make links to each unique
> publisher name:
>
> while ($cartoon = mysql_fetch_assoc($result)) {
> $pub_sidebar[] = "<ul class='sidebar-menu'><a class='img-link'
> href='{$_SERVER['PHP_SELF']}?p={$cartoon['publisher_id']}'
> title=\"{$cartoon['publisher_name']}\">{$cartoon['publisher_name']}</a></ul>";
> }
>
>
> This prints:
> The New York Times: Sunday Styles
>
> The New York Sun
>
> Metro NY
>
> The New York Sun
>
>
> I'd like to stop the NY Sun from appearing twice! What have i missed here?
SELECT DISTINCT publisher.publisher_name etc... ??
--
s/:-[(/]/:-)/g
Brian GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org
Navigation:
[Reply to this message]
|