<td>
<label id="" class="" for="">Surname/Last Name
<span class="required">*</span>
</label>
</td>
<input type="text" id="" name="lname" size="20" required value="" class=" " aria-required="true" />
<td>
<label id="" class="" for="">Agency
<span class="required">*</span>
</label>
</td>
<td>
<input type="text" id="agency" name="agency" size="30" required value="" class=" " aria-required="true" /> </td>
<td>
<label id="" class="" for="">Organizer
<span class="required">*</span>
</label>
</td>
<td>
<input type="text" id="trorganizer" name="trorganizer" size="30" required value="" class=" " aria-required="true" />
</td>
//my php code here
$lname=strtoupper($_POST['lname']);
$agency=strtoupper($_POST['agency']);
$trorganizer=strtoupper($_POST['trorganizer']);
$sql1 = "INSERT INTO personalinfo (lname) VALUES ('$lname')";
$sql2 = "INSERT INTO pep (agency) VALUES ('$agency')";
$sql3 = "INSERT INTO training (trorganizer) VALUES ('$trorganizer')";
//I think I have a problem with my sql code
mysql_select_db('DATABASENAME');
$retval = mysql_query($sql, $conn);
if(! $retval)
{
die('Could not enter data: ' . mysql_error());
}
echo "Data added successfully!";
mysql_close($conn);
}
}
任何人都可以幫助我如何將數據插入到不同的表?我無法保存這些數據。謝謝你的幫助。非常感謝! 謝謝!插入數據不同的表
sql字符串不會自行執行,你沒有任何查詢代碼? – charlietfl 2015-02-23 17:07:19
您使用哪個API連接? – 2015-02-23 17:10:19
'$ retval = mysql_query($ sql $ conn);'你錯過了一個逗號,一件事。 – 2015-02-23 17:13:39