Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Question Rid duplicates in list due to 1 < fields & how to get multiple entries on same page

    I have a mythology project I've been working on for a few years.

    First I have a list of the data displayed from sql onto a php page, that looks something like this:

    Abatwa
    Bicorn
    Faerie, Banshee, Bean-Sidhe
    Faerie, Brownie
    Faerie, Brownie
    Faerie, Pooka
    Faerie, Redcap

    The first words are $name, the secondary ones (like Brownie) are $sname, and the third are $tname. How can I tell this list to distinctly display only one version of what there is?

    Secondly comes the problem of displaying the information. I didn't have a problem before but now I have more than one 'article' of information by two different sources.

    As it is now I have fields sorta like this:
    $idata: Paragraphs of Description
    $sourcename: Name of Source
    $sourceurl: Source URL

    And then on a PHP page I tell it to display all of these. This isn't the exact code but just a summary:
    Code:
    (paragraphs of description)
    
    Source:
    <a href=$sourceurl>$sourcename</a>
    However, I now have an article that really contains two different sections of information, each with their own author. This means two different rows with the same $cname, $sname, and $tname, but I'd like them to be displayed on the same page, which uses a get url type method.

    What I'd like to do is have it then look like:
    Code:
    (paragraphs of description)
    
    Source:
    <a href=$sourceurl>$sourcename</a>
    
    (paragraphs of description)
    
    Source:
    <a href=$sourceurl>$sourcename</a>
    What type of script would I use to tell the PHP page to summon both of these articles, one after another, without it going (paragraphs of description)(paragraphs of description) $sourceurl $sourceurl $sourcename $sourcename?

    I still don't know why it only displays information for one of the fields, even if the names are the same.

    PHP Code:
      $sql .= "SELECT * FROM creatures where name = '$_GET[name]'";
      if (!empty(
    $sname)) $sql .= " AND sname = '$_GET[sname]'";
      if (!empty(
    $tname)) $sql .= " AND tname = '$_GET[tname]'";
      if (!empty(
    $source)) $sql .= " AND createdby = '$_GET[source]'"
    Wouldn't this tell it to get all the information it can, not just from one row?
    Last edited by TwilightRealm; 01-31-2009 at 09:20 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •