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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down ***Problem Displaying Full Name Not Table ID***

    Hey. i have a small problem i think you guys might be able to help me out with. i'm trying to call up the name of the chairperson and secretary of all the meets stored within my database at the moment is is only one meeting. i have an occurrences table, with the two fields chairperson and secretary which relate to the staff table filed named staff_id.

    The problem is when i call up chairperson or secretary from the database to display i get there staff_id example 1, 2 etc.. but i need to display there full name. but i can't seem to find out for the life of me what to do. can you help?

    Any more information needed please let me know?? thanks

    Code:
    <?php
    
    $result = 	"SELECT * FROM web_meeting
    				LEFT JOIN web_occurrences ON web_meeting.occurrence_id =web_occurrences.occurrence_id";
    				
    $result = mysql_query ($result) or die (mysql_error());
    while($row = mysql_fetch_assoc($result)) 
    	{
    		$meetings .= '
    			<div class="meeting png_bg">
    				<h5>'.$row['title'].'</h5>
    				<p>
    				<b>Terms of reference:</b>  '.$row['reference'].' <br />
    				<b>Chairman:</b> '.$row['chairperson'].' - <b>Secretary:</b> '.$row['secretary'].' <br />
    				<b>Booked:</b> '.$row['date'].'<br />
    				</p>
    				<a herf="#">View Apologies</a> | <a herf="#">View Details</a> | <a herf="#">View Members (2)</a>
    			</div> <br />
    		';		
    	 }
    	 
    ?>

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Please show the table schema of all tables involved. Most likely you want to perform an INNER JOIN, not a LEFT (OUTER) JOIN, but if we can see your tables it would be helpful.

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    According to the same post on phpfreaks this has been solved...
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)


  •  

    Posting Permissions

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