我想用wordpress創建酒店預訂系統。現在,我知道在非wordpress模式下進行數據檢索的所有查詢,但我在處理wordpress時遇到了一些數據組織問題。我的酒店詳細信息存儲在帖子表中,並作爲酒店的自定義字段。對於酒店的價格,我創建了一個不同的表格,根據不同月份的價格變化。我想在我的搜索結果頁面中顯示這樣的數據:WordPress的MySQL數據檢索酒店預訂系統
Hotel_1 Name: (Will come from Post Name)
Hotel_1 Details: (Will come from custom fields)
Hotel_1 description: (will come from excerpt)
Room_1 Name for Hotel_1: Total Rates for selected dates
Room_2 Name for Hotel_1: Total Rates for selected dates
----------------------------------------------------------
Hotel_2 Name: (Will come from Post Name)
Hotel_2 Details: (Will come from custom fields)
Hotel_2 description: (will come from excerpt)
Room_1 Name for Hotel_2: Total Rates for selected dates
Room_2 Name for Hotel_2: Total Rates for selected dates
----------------------------------------------------------
and so on and so forth.....
----------------------------------------------------------
Pagination>>
----------------------------------------------------------
我費率表看起來像這樣
mysql> select * from rates;
+-------------+---------+---------+-------------------+------------+------------
+-----------+--------------+-----------+------------------------------------+
| primary_key | post_id | room_id | room_type | start_date | end_date
| adultRate | extraBedRate | childRate | inclusions |
+-------------+---------+---------+-------------------+------------+------------
+-----------+--------------+-----------+------------------------------------+
where post_id = ID of the post in wp_posts table
room_id = ID given to a room
room_type = Name of the room
1後(POST_ID)可能有幾個room_types。 任何幫助,非常感謝。謝謝。
我只需要幫助 a。如何組織或創建表間關係以獲得期望的結果,& b。如何讓他們在wordpress中顯示。有些類或功能需要考慮。
我是非常非常新的PHP和MySQL,這是我的第一個任務。我的技能水平是可以對代碼進行更改的,但現在我很難從頭開始編寫代碼。然而,在這裏的幫助下,我打算學習。
謝謝
我建議你從一個PHP和MySQL教程開始,其中噸很容易在谷歌搜索。 – hakre