如果我有這樣的如何在一個表中將兩個表與一個自動創建的id鏈接起來?
tbl_attributes
---------------
id_attrib (auto incremented, primary key)
col1
col2
一個表,另一個表
tbl_weight
--------------
id_attrib *(not primary key)*
field
當談到時間,我插入值COL1和COL2的id_attrib是自動遞增將值插入表tbl_attributes 。我怎麼能插入id_attribute相同的自動遞增值到表tbl_weight中的字段id_attrib。這樣做的原因是因爲 我正在尋找輸入到tbl_attributes中的特定值,並且一旦im查找的值已被插入到tbl_attributes中,那麼與此相關的更多信息將被輸入到tbl_weight中。
否則,如果我結合這看起來像
tbl_attributes
----------------
id_attrib
col1
col2
field (from tbl_weight table)
領域列將包含空數據了很多,當事情被滿足,我不想那樣做將只包含數據的表。
所以也許獲取當前auto_increment被用於tbl_attributes並插入該值。我正在考慮使用innodb格式,但我對這個世界很陌生,事情可能會搞砸。
我從來沒有檢查查詢的結果,因爲我沒有看到一個目的。它的目的是什麼? thnx – 2011-04-13 02:41:52
檢查結果的目的是什麼?要獲得請求是否成功?例如。 'mysql_query('BAD MYSQL REQUEST')'...這會引發錯誤。 – Wh1T3h4Ck5 2011-04-13 02:44:32