2017-02-26 14 views
-2

私は2つの部分からなるフォームを持っています.1つは情報用、もう1つはユーザーが確認できる機能の長いリストです。ここでは、コードは次のとおりです。mysqlの複数のテーブルに大量のデータを挿入する方法

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 

<body> 
<form method="post"> 
<h1> Basic Info </h1> 
<input type="text" name="title" /> 
<input type="text" name="city" /> 
<input type="text" name="location" /> 
<input type="text" name="type" /> 
<h1> Features </h1> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
<input name="feature" type="radio" /> 
</form> 
</body> 
</html> 

と私は2つのテーブル(p_detailとp_feature)を持って、私は、ユーザーの基本的な情報がp_featureテーブルにp_detailテーブルと機能のインサートに挿入することを望みます。 私のp_featureテーブルには、(id、property_id、features)という列があり、p_detailには(id、title、location、cityなど)があります。主な問題はp_featureテーブルにあります。 p_featureのproperty_id。どうすればいい?

よろしく

答えて

0

、 'ID' はp_deatilで増分主キーであると仮定し

挿入 'p_detail'、あなたのようなINSERT_IDを取得し、後

$id_p_detail = $mysqli->insert_id; 
関連する問題