|
 |
|
การ insert ข้อมูลลงในฐาน oracle+php เก็บไว้ในตัวแปร array |
|
 |
|
|
 |
 |
|
ชื่อไฟล์ test.php
Code (PHP)
<form action="regis_std.php" method="post" name="form1">
<tr align="center" bgcolor="#CCCCCC">
<td width="33">คนที่</td>
<td width="40">เพศ</td>
<td width="35">อายุ</td>
<td width="115">ชั้นปี</td>
<td width="245">สถานศึกษา</td>
</tr>
<tr>
<td>
<input type="text" name="txt_no_family" size="10"/></td>
<td><select name="txt_sex" >
<option value="1">ชาย</option>
<option value="2">หญิง</option>
</select></td>
<td><input type="text" name="txt_age_sibling" size="10"/></td>
<td><input type="text" name="txt_class" /></td>
<td><input type="text" name="txt_scholl" /></td>
</tr>
<tr>
<td>
<input type="text" name="txt_no_family" size="10"/></td>
<td><select name="txt_sex" >
<option value="selected"> </option>
<option value="1">ชาย</option>
<option value="2">หญิง</option>
</select></td>
<td><input type="text" name="txt_age_sibling" size="10"/></td>
<td><input type="text" name="txt_class" /></td>
<td><input type="text" name="txt_scholl" /></td>
</tr>
<tr>
<td>
<input type="text" name="txt_no_family" size="10"/></td>
<td><select name="txt_sex" >
<option value="selected"> </option>
<option value="1">ชาย</option>
<option value="2">หญิง</option>
</select></td>
<td><input type="text" name="txt_age_sibling" size="10"/></td>
<td><input type="text" name="txt_class" /></td>
<td><input type="text" name="txt_scholl" /></td>
</tr>
</form>
ชื่อไฟล์ regis_std.php ------>>> โค้ดด่านล่างกรณี insert แค่ 1 record ไม่มีปัญหา แต่ต้องทำยังไงค่ะต้องการ insert อีก 2 record
Code (PHP)
<?
$str = "INSERT INTO FAMILY_PROFILE";
$str .="(\"family_no\",\"no_family\",\"student_id\",\"stady_sibling\",\"sex\",\"age_sibling\",\"class\",\"school\") ";
$str .="VALUES";
$str .="(S_FAMILY.NEXTVAL,'".$_POST['txt_no_family']."','".$_POST['student_id']."', '".$_POST['txt_stady_sibling']."','".$_POST['txt_sex']."','".$_POST['txt_age_sibling']."','".$_POST['txt_class']."','".$_POST['txt_school']."') ";
$Parse = oci_parse($objConnect,$str);
oci_execute($Parse,OCI_DEFAULT);
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-01-11 16:51:45 |
By :
eii-mian |
View :
1561 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 03
|