Jump to content

MissAli

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MissAli's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am cuurently being a site that lists publications and their authors. My problem is displaying the results of my databases. I have 3 tables publications, people and peoplexpublications Publications - contains all the info about the publication, title year etc and publication_code People - contains a list of people and people_code peoplexpublications - contains the publication_code and people_code when a person is associated with a publication, this table can contain one publication_code to many people_codes as more than one person can be a part of a publication. My problem is when i try to display all this information from my 3 tables. here is the code [code] $sql = " SELECT * FROM publications WHERE publications.publication_status = 'live' ORDER BY publications.publication_year DESC "; $result = mysql_query($sql, $conn)or die(mysql_error()); // Set variables from the query for use in the html while ($row =mysql_fetch_array($result,MYSQL_ASSOC)){     $publication_code = $row['publication_code'];     $publication_type=$row['publication_type'];     $publication_summary=$row['publication_summary'];     $publication_title=$row['publication_title'];     $publication_year=$row['publication_year'];     $pkey = $row['pkey'];     $publication_status=$row['publication_status']; $sql = " SELECT * FROM peoplexpublications as pxp, people WHERE pxp.publication_code = $publication_code AND pxp.people_code = people.people_code "; $result2 = mysql_query($sql, $conn)or die(mysql_error()); while ($row2 =mysql_fetch_array($result2,MYSQL_ASSOC)){ $peoplexpublication_id=$row2['peoplexpublication_id'];     $people_code=$row2['people_code'];     $last_name =$row2['last_name'];                     $display_block .= "<p>$last_name, $publication_title,$publication_type,(<i>$publication_year</i>)</p>"; } }     [/code] Nowthis is producing a result that looks like this: De Souza, a publications teste,Peer Review,(2006) Craig, a publications teste,Peer Review,(2006) Murnaghan, a publications teste,Peer Review,(2006) De Souza, zebra zebra,zebra,(2005) Craig, zebra zebra,zebra,(2005) De Souza, PostGrad Couses 2006,Book Chapters,(2005) Craig, PostGrad Couses 2006,Book Chapters,(2005) Gallagher, PostGrad Couses 2006,Book Chapters,(2005) Murnaghan, PostGrad Couses 2006,Book Chapters,(2005) Craig, Study of a woman on mars,Paper,(2005) Regan, Study of a woman on mars,Paper,(2005) Prenter, Study of a woman on mars,Paper,(2005) Cassidy, Study of a woman on mars,Paper,(2005) Murphy, Study of a woman on mars,Paper,(2005) However i would like to group all the names that are associated with the same publication together on one line and display that publication once only. So in this example i would see four titles only. Anyone , any suggestions Thnaks in advance
×
×
  • 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.