在我的網站上顯示用戶好友,但沒有他們的個人資料照片嗎?獲取不同人的用戶詳細信息
我有2個數據庫。一個是用戶,那就是我保存所有用戶的詳細信息。第二個數據庫有,如果他們是朋友呢?
我的問題是如何從用戶表中獲取他們的個人資料照片。
p.s.輪廓PIC行Proimg
這是我的代碼
表
In the 2nd database i have the friends details id Sender Receiver Accepted 1 bob bill 1 2 fred bill 3
接受:
1 means that they havent accepted or declined 2 means that they have accepted 3 means that they have declined
在第1表我有用戶的詳細信息...
id Fullname Password proimg birthday 1 bill **** hi.jpg 1991-01-01 2 bob **** hello.jpg 1991-07-02 3 fred **** hey.jpg 1991-10-05 <?php $term = $fullname; $sql12 = mysql_query("select * from Friends where Reciver like '%$term%' or Sender like '%$term%'"); $Friends = mysql_num_rows($sql12); $t=1; while($t<=$Friends) { while ($row = mysql_fetch_array($sql12)) { If ($row['accepted'] == 2) { Echo '<img src="images/defaultprof.png" width="45px" height="45px"/>'; } else { $_SERVER['PHP_SELF']; } } $t++; } ?>
您能否顯示數據庫中每個表有哪些字段? – 2011-05-25 06:53:13
更好嗎? – Ryan 2011-05-25 07:04:09
'發件人'和'收件人'是什麼類型的字段?如果他們是varchar類型,那麼我強烈建議你從兩個用戶的表1中存儲用戶id。 – 2011-05-25 07:13:16