2017-02-26 41 views
-2

我有一个表格,它有两个部分,一个是信息,第二个是用户可以检查的长列表。下面是代码:如何在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> 

和我有两个表(p_detail和p_feature),我希望该用户的基本信息p_detail表和要素插入插入p_feature表。 我的p_feature表中有以下列(id,property_id,features)和我的p_detail(id,title,location,city等等)。主要问题是在p_feature表中,我希望id在p_detail中应该是相同的在p_feature中的property_id。我怎么能这样做?

问候

回答

0

假设 '身份证' 是p_deatil增量主键,

插入 'p_detail',你得到的INSERT_ID像,后

$id_p_detail = $mysqli->insert_id; 
相关问题