greg Posted October 20, 2006 Share Posted October 20, 2006 Hi,I have a folder named "picture" with pictures of each member. Some members has one pic, others has more than one. I also have a table named "member_picture" with the file name that correspond to each member. In the following code, I want to display the member images in the second row ($row["pic"]).Thank you for your help.greg[CODE]$sql="select u.id, u.name, u.number, u.accept, p.pic, p.id from member_user u left join member_picture p on u.id=p.id where u.accept=1";$results=mysql_query($sql);$rows=mysql_num_rows($results);if ($rows==0) $cont.='<tr><td class="bodytxt" align="center" colspan="2">There is no existant member</td></tr>';else { while ($row=mysql_fetch_array($results)) { $cont.='<tr> <td class="bodytxt" align="left"><a href="viewdetails.php?id='.$row["id"].'&nam='.$name.'"><b>'.$row["name"].'</b></a></td> <td class="bodytxt" align="left"> '.$row["pic"].'</b></a></td> <td class="bodytxt" align="center"><a href="denynew.php?id='.$row["id"].'"> deny </a></td> <td class="bodytxt" align="center"><a href="deletemember.php?id='.$row["id"].'" onClick="return confirm(\'Are you sure you want to delete this member?\');">delete</a></td> </tr>'; }}[/CODE] Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 20, 2006 Share Posted October 20, 2006 You don't state if you are getting any errors with your code. I will assume that your code is working and that the value of 'pic' is the name of the image. In that case to display the picture(s) you could do the following (note the 2nd TD line):[code]$sql="select u.id, u.name, u.number, u.accept, p.pic, p.id from member_user u left join member_picture p on u.id=p.id where u.accept=1";$results=mysql_query($sql);$rows=mysql_num_rows($results);if ($rows==0) $cont.='<tr><td class="bodytxt" align="center" colspan="2">There is no existant member</td></tr>';else { while ($row=mysql_fetch_array($results)) { $cont.='<tr> <td class="bodytxt" align="left"><a href="viewdetails.php?id='.$row["id"].'&nam='.$name.'"><b>'.$row["name"].'</b></a></td> <td class="bodytxt" align="left"><img src=\"PATHTOPICTUREFOLDER\'.$row["pic"].'\"></b></a></td> <td class="bodytxt" align="center"><a href="denynew.php?id='.$row["id"].'"> deny </a></td> <td class="bodytxt" align="center"><a href="deletemember.php?id='.$row["id"].'" onClick="return confirm(\'Are you sure you want to delete this member?\');">delete</a></td> </tr>'; }}[/code] Quote Link to comment Share on other sites More sharing options...
greg Posted October 21, 2006 Author Share Posted October 21, 2006 Yes, the code does not give me errors.Your change works perfectly! Thank you for your helpgreg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.