Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยผมหน่อยครับ จะเก็บค่าแบบหลายแถวลงฐานข้อมูลครั้งเดียวกันได้อย่างไร



 

ช่วยผมหน่อยครับ จะเก็บค่าแบบหลายแถวลงฐานข้อมูลครั้งเดียวกันได้อย่างไร

 



Topic : 048440



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์




ช่วยหน่อยนะครับ ผมมึนมาหลายวันแล้ว
คือผมต้องการ เก็บค่าข้อมูลทึ่ดึงมาจาก2 table มาโชว์ใน textbox แล้วนำมาคำนวณ แต่ตอนจะเก็บลง อีกฐานข้อมูล ไม่รุ้จะทำไงแล้วครับ
โดยข้อมูลที่ดึงมาโชว์ที่เตรียมลง ฐานข้อมูลมีหลายแถว
แบบนี้ครับ

<body>
<? include("connect.php");
$regdate2 = date("Y-m-d");
$strSQL = "SELECT * FROM datavaccine";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$objQuery = mysql_query($strSQL);
?>
<blockquote>
<p><strong> </strong></p>
<table width="946" align="center">
<tr align="center">
<th width="980" scope="col"><h2><strong>เบิกวัคซีนสำหรับสถานีอนามัย/หน่วยงาน ในเครือข่าย</strong></h2></th>
</tr>
</table>
</blockquote>
<form id="form1" name="form1" method="post" action="saveoders.php">
<table width="983" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<th><table width="1018" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<th></th>
<th colspan="4" align="right"><?php echo"$_SESSION[CustomerID]" ?>
&nbsp;</th>
<th>&nbsp;</th>
<th><?php echo"$_SESSION[CustomerName]" ?></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<tr>
<th colspan="9">&nbsp;</th>
</tr>
<tr>
<th width="136"> <div align="center">รหัสยา</div></th>
<th width="240"> <div align="center">ชื่อยา </div></th>
<th width="72">คงเหลือ</th>
<th width="148"> <div align="center">จำนวนผู้ที่จะฉีด(คน) </div></th>
<th width="164"> <div align="center">ขนาดบรรจุ(Dose/Vial)</div></th>
<th width=""> <div align="center"></div></th>
<th width="203">ต้องการเบิก(Vial)</th>
<th width="203">&nbsp;</th>
<th width="203">&nbsp;</th>
</tr>
<?
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center">
<input type="text" name="VaccineID" value="<?=$objResult["VaccineID"];?>"size="5"readonly="readonly"/>
</div></td>
<td><div align="left"><?=$objResult["VaccineName"];?></td>

<td align="center"> <input name="onhand[<?=$i;?>]" type="text" id="onhand[<?=$i;?>]" onkeypress="numonly();code(this)" onkeyup="cal_price('onhand[<?=$i;?>]','person[<?=$i;?>]','Pack[<?=$i;?>]','total_onh[<?=$i;?>]','give[<?=$i;?>]')" size="12" maxlength="2"/></td>
<td align="center"><label>
<input name="person[<?=$i;?>]" type="text" id="person[<?=$i;?>]" onkeypress="numonly();code(this)" onkeyup="cal_price('onhand[<?=$i;?>]','person[<?=$i;?>]','Pack[<?=$i;?>]','total_onh[<?=$i;?>]','give[<?=$i;?>]')" size="12" maxlength="3"/>
</label></td>
<? $str="select customer.datavaccine.Pack from customer.datavaccine where customer.datavaccine.Pack = '".$objResult["Pack"]."'";
$a=mysql_query($str);
while($objResult1 = mysql_fetch_array($a))
{
$b[$i]=$objResult1["Pack"];
}
?>
<td><div align="center">
<input name="Pack[<?=$i;?>]" type="text" id="Pack[<?=$i;?>]" value="<?=$b[$i]?>" size="5" readonly="readonly" />
</div></td>
<td><div align="center">
<input name="total_onh[<?=$i;?>]" type="hidden" id="total_onh[<?=$i;?>]" size="5"readonly="readonly" />
</div></td>
<td align="center"><input name="give[<?=$i;?>]" type="text" id="give[<?=$i;?>]" size="10" maxlength="2" /></td>
<td align="center"><input name="CustomerID[<?=$i;?>]" type="text" id="CustomerID[<?=$i;?>]" value="<?=$_SESSION["CustomerID"];?>" size="5"readonly="readonly" /></td>
<td align="center"><input name="date[<?=$i;?>]" type="text" id="date[<?=$i;?>]" value="<?=$regdate2?>" size="8" readonly="readonly" /></td>
<? $i++;
}
?>
</tr>
</table></th>
</tr>
</table>
<table width="200" align="center">
<tr align="center">
<th width="10" scope="col">&nbsp;</th>
<th width="163" align="center" scope="col"><input type="submit" name="Save" id="Save" value="Save" size="20" />
</th>
<th width="11" align="center" scope="col">&nbsp;</th>
</tr>
</table>
<br>
<?
mysql_close();
?>
</form>
</body>



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-09-08 21:06:46 By : chaimon52 View : 705 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Go to : PHP MySQL Add/Insert Multiple Record






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-09-08 21:39:42 By : webmaster
 


 

No. 2



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


ลองทำแล้วครับมันเข้าแค่แถวเดียวครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-09-08 21:55:41 By : chaimon52
 

 

No. 3



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (PHP)
mysql_query($strSQL) or die(mysql_error());


จะได้รู้ว่า error เพราะอะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-09-08 22:03:21 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยผมหน่อยครับ จะเก็บค่าแบบหลายแถวลงฐานข้อมูลครั้งเดียวกันได้อย่างไร
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่