|
 |
|
ขอถามเรื่องการแก้ใขข้อมูลในฐานข้อมูลจากการเพิ่มข้อมูลใหม่ กับ การ export ข้อมูลจากวันที่ที่เลือก |
|
 |
|
|
 |
 |
|
อันนี้ code export ครับ
Code (PHP)
<?ob_start();?>
User data
<?
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename="export user.csv"');
$host="localhost";
$username="root";
$password="root";
$db="cs";
$tb="user";
mysql_connect( $host,$username,$password) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ ");
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
echo "รหัสพนักงาน,ชื่อ,สกุล,User,Password,แผนก,สถานะ, \n";
$sql = "select * from $tb";
$dbquery = mysql_query($sql);
$num_rows = mysql_num_rows($dbquery);
$i=0;
while ($i < $num_rows){
$result= mysql_fetch_array($dbquery);
echo "$result[Code],$result[F_name],$result[L_name],$result[User],$result[Pass],$result[Section],$result[Status],\n";
$i++;
}
?>
|
 |
 |
 |
 |
Date :
2012-10-08 11:46:21 |
By :
prapakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ข้อแรกนะครับ คือผมมีฐานข้อมูลของ stock สินค้า กับฐานข้อมูลการเบิกสินค้า โดยมีขั้นตอนการทำงานคือ
1.ผมมี form เพื่อเพิ่มรายการ stock ซึ่งประกอบด้วยหมายเลข stock ชื่อ stock และจำนวน stock
2.ผมทำ form เพื่อเพิ่มรายการ การเบิก/รับ stock ของแต่ละตัวซึ่ง form นี่ผมทำ autofill ในส่วนของการกรอก stock
3.เมื่อมีการเบิก/รับ stock ก็จะมีการแก้ใขจำนวน stock ใน form การเบิก/รับแล้ว save ข้อมูลลงฐานข้อมูลการเบิกสินค้า
สิ่งที่ผมต้องการคือ เมื่อผมทำการเก็บข้อมูลของการเบิก/รับสินค้าลงฐานข้อมูลการเบิกสินค้าแล้ว ให้ทำการแก้ใขจำนวน stock ในฐานข้อมูลของ stock สินค้าด้วยครับ ซึ่งตัวนี้ผมยังงอยู่ ยังไงรบกวนช้วยดูให้หน่อยครับ แต่ถ้าท่านใดยังงงอยู่ เดี๋ยวบ่ายๆ ผมจะ up รูปให้ดูครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2012-10-09 08:19:58 |
By :
prapakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตัว export น่ะครับผมลองทำแล้วแต่ยังไม่ได้ พอมีตัวอย่าง หรือ บทความที่เกี่ยวข้องไหมครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2012-10-11 11:14:21 |
By :
prapakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|