我有一個帶有用戶名,密碼和屬性名稱的mysql表,它允許用戶登錄到一個安全的網站部分。現在我想要做的就是從第二個表中拉入pdf,在第二個表中檢查表1中的屬性名稱與表2中pdf文檔的documentCategory,然後根據日誌記錄僅顯示相關的pdf在用戶。 (希望這是有道理的)PHP/MySQL加入2個表
表結構:
Table 1 -
userid password property
Table 2 -
pdfFile documentCategory
Where table1.property = table2.documentCategory
我如何能得到在PHP這個工作任何幫助將不勝感激,因爲我現在完全喪失。
S
謝謝大家的幫助 - 非常感謝:) 結束了得到這個工作: $用戶id = $ logResult [「用戶id」]; $ query = mysql_query(「select * from table1 inner join table2 on table1 .property = table2.documentCategory where table1.userid ='$ userid'」); $ result = mysql_fetch_array($ query); \t \t \t \t echo'
'。$ result ['documentFilename']。'
'。 PHP_EOL; \t \t \t \t \t \t echo''。$ result ['documentCategory']。'
'。 PHP_EOL; – ss888 2010-09-01 08:26:02