开发者

posting into two linked tables

I want to post something to my database which consists of two tables which are linked with a foreign key. I want to be able to post something to the first table which has only two cells (city and city_id) via php and then get redirected to the second table where someone can post detail about places of the city (houses squares ect (city_id is the foreign key here)) whith an one-to-many relationship. How can I do that? Should I write two php files and how can I connect th开发者_开发知识库e two tables?


You can insert the city records, use mysql_insert_id() after the insert to get the cityid for the inserted record, and then redirect to a details posting page with e.g. a URL parameter for the cityid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜