|
 |
|
รบกวนสอบถามหน่อยค่ะ พอดีต้องการเก็บข้อมูลเข้า Database โดยมีการกรอกข้อความเข้ามาที่ระบบนะคะ |
|
 |
|
|
 |
 |
|
รบกวนสอบถามหน่อยค่ะ พอดีต้องการเก็บข้อมูลเข้า Database ดังนี้นะคะ โดยกรอกข้อมูลมาจากหน้า Code ด้านล่าง ไม่ทราบต้องเขียนโค้ดประมาณไหนค่ะ รบกวนด้วยค่ะ
Code (SQL)
CREATE TABLE `revenue` (
`Year` year(4) NOT NULL,
`Month` int(11) NOT NULL,
`Product` int(11) NOT NULL,
`Type` varchar(100) NOT NULL,
`Revenue` int(11) NOT NULL,
`Insert_Date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=tis620;
ข้อมูลตัวอย่าง
2014,Jan,RBT,Projection,5000000
2014,Jan,RBT,Actual,3840000
2014,Jan,RBT,Estimate,3840000
2014,Jan,RT,Projection,4080000
2014,Jan,RT,Actual,3950000
2014,Jan,RT,Estimate,3950000
Code (PHP)
<?php
include ("config/config.php");
?>
<!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=windows-874" />
<title>ระบบจัดการ Revenue</title>
</head>
<body>
<table width="58%" border="0" align="center" >
<tr>
<td>
<table width="100%" border="1" bordercolor="#55AAFF">
<tr>
<td colspan="4" align="center" class="menu_head">ระบบจัดการ Revenue</td>
</tr>
<tr>
<td width="14%" align="right" class="text13">Year : </td>
<td colspan="3" ><select name="lstYear" id="lstYear">
<?
for ($i=2014;$i <=2019;$i++) {
echo "<option value ='$i'>$i
</option>";
}
?>
</select></td>
</tr>
<tr>
<td align="right" class="text13">Month : </td>
<td colspan="3" ><select name="lstMonth" id="lstMonth">
<?
$month_list = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for ($i=0;$i < sizeof($month_list);$i++) {
echo "<option value ='".($i+1)."'>$month_list[$i] </option>";
}
?>
</select></td>
</tr>
<tr>
<td rowspan="2" align="right" class="text13">Product</td>
<td colspan="3" align="center" class="text13">Rev.Type</td>
</tr>
<tr>
<td width="19%" align="center" class="text13">Projection</td>
<td width="19%" align="center" class="text13">Actual</td>
<td width="22%" align="center" class="text13">Estimate</td>
</tr>
<?
$sql = "SELECT productkey,productname FROM product order by productkey";
//print $sql;
$result = mysql_query($sql);
$num = mysql_num_rows($result);
while($arr = mysql_fetch_array($result))
{
$productkey = $arr['productkey'];
$productname = $arr['productname'] ;
?>
<tr>
<td align="right" class="text13"><?=$productname?>:</td>
<td> <input name="projection" type="text" id="projection" /></td>
<td> <input name="actual" type="text" id="actual" /></td>
<td> <input name="estimate" type="text" id="estimate" /></td>
<? } ?>
</tr>
<tr>
<td height="40" colspan="4" align="center" class="text13">
<input type="submit" name="Submit" value="บันทึก" />
<input name="Reset" type="reset" id="Reset" value="ยกเลิก" /> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2014-02-24 14:35:03 |
By :
ฟ้า |
View :
661 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

PHP MySQL Add/Insert Record
|
 |
 |
 |
 |
Date :
2014-02-25 20:59:04 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|