MikeDXUNL Posted February 17, 2007 Share Posted February 17, 2007 <?php $result = mysql_query("SELECT * FROM members LEFT JOIN profile ON members.id = profile.id WHERE members.id='$id'") or die('Query failed: ' . mysql_error()); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $line['displayname']. "</td>"; echo "</tr><tr><td>"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr><td align=\"center\" width=\"20%\">"; echo "<img src=\"userphotos/" .$line['photo']. "\">"; ?> </td> <td valign="top" width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="quote"><?php echo "Quote: " .$line['quote']. "</td></tr><tr><td>"; echo "Name: " .$line['name']. "<br />"; echo "Location: " .$line['location']. "<br />"; echo "Gender: " .$line['gender']. "<br />"; echo "Status: " .$line['status']. "<br />"; echo "Website: <a href=\"" .$line['website']. "\" target=\"_new\">" .$line['website']. "</a><br />"; echo "Job:" .$line['occupation']. "<br />"; }?> alright. well it will echo everything from the members table, but nothing from the profile table. and have no clue why? could someone please help? Link to comment https://forums.phpfreaks.com/topic/38867-not-echoing-fields-from-profile-table/ Share on other sites More sharing options...
redarrow Posted February 17, 2007 Share Posted February 17, 2007 look up mysql join agin ok trust. Link to comment https://forums.phpfreaks.com/topic/38867-not-echoing-fields-from-profile-table/#findComment-186991 Share on other sites More sharing options...
o3d Posted February 17, 2007 Share Posted February 17, 2007 It might be that there is something wrong with your join (members.id = profile.id) shouldn't it be something like members.id = profile.memberid? and i would not recommend a left join in this case because a member should always have at least one profile (which is a one to many relation from the members table). Hope this helps. Link to comment https://forums.phpfreaks.com/topic/38867-not-echoing-fields-from-profile-table/#findComment-187008 Share on other sites More sharing options...
MikeDXUNL Posted February 17, 2007 Author Share Posted February 17, 2007 lol you are right, i got to thinking and should move all the profile-related stuff to the profile table. i started the tables without thinking and put stuff like "hobby, photo, job" in the member table so i will probably re-write it tonight, thank though Link to comment https://forums.phpfreaks.com/topic/38867-not-echoing-fields-from-profile-table/#findComment-187095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.