|
|
|
ช่วยเขียนโค๊ดติดต่อฐานข้อมูล sql กับโค๊ดฐานข้อมูลให้หน่อยคับ งงมาก |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>Test</title>
</head>
<?php
if(isset(form1))
{
$string1=$_POST["no.1"];//,$string13=$_POST["no.13"],;
$string2=$_POST["no.2"];//,$string14=$_POST["no.14"],;
$string3=$_POST["no.3"];//,$string15=$_POST["no.15"],;
$string4=$_POST["no.4"];//,$string16=$_POST["no.16"],;
$string5=$_POST["no.5"];//,$string17=$_POST["no.17"],;
$string6=$_POST["no.6"];//,$string18=$_POST["no.18"],;
$string7=$_POST["no.7"];//,$string19=$_POST["no.19"],;
$string8=$_POST["no.8"];//,$string20=$_POST["no.20"],;
$string9=$_POST["no.9"];//,$string21=$_POST["no.21"],;
$string10=$_POST["no.10"];//,$string22=$_POST["no.22"],;
$string11=$_POST["no.11"];//,$string23=$_POST["no.23"],;
$string12=$_POST["no.12"];//,$string24=$_POST["no.24"],;
$objConnect = mysql_connect("localhost","root","test") or die("Error Connect to Database");
$objDB = mysql_select_db("test");
$strSQL = "INSERT INTO status(no.1, no.2, no.3) VALUES('$string1', '$string2', '$string3')";
mysql_query($strSQL) or die('Error, insert query failed');
//mysql_close($objConnect);
}
?>
<html>
<head>
<title>Test</title>
</head>
<style type="text/css">
<!--
.style1 { color: #006600;
font-weight: bold;
}
.style2 { color: #0000FF;
font-weight: bold;
}
.style3 { color: #FF0000;
font-weight: bold;
}
body {
background-image: url(images/or13.jpg);
}
-->
</style>
</head>
<body>
<div align="center">
<p> </p>
<table width="230" height="467" border="1" cellpadding="0" cellspacing="0">
<col width="35" />
<col width="145" />
<col width="77" span="8" />
<col width="75" span="6" />
<col width="64" />
<tr height="34">
<td width="48" height="34" bgcolor="#99FF99"><div align="center"><strong>Number Of</strong></div></td>
<td colspan="2" bgcolor="#FFFF00"><div align="center"><a>STATUS Nitrogen tank start shift</a></div></td>
</tr>
<tr height="26">
<td height="26" bgcolor="#99FF99"><div align="center"><strong>Nitrogen tank</strong></div></td>
<td width="84"><div align="center"><strong>Day</strong></div></td>
<td width="90"><div align="center"><strong>Night</strong></div></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.1</strong></div></td>
<td width="84" height="24"><select name="no.1">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.14">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.2</strong></div></td>
<td><select name="no.2">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.15">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.3</strong></div></td>
<td><select name="no.3">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.16">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.4</strong></div></td>
<td><select name="no.4">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.17">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.5</strong></div></td>
<td><select name="no.5">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.18">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.6</strong></div></td>
<td><select name="no.6">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.19">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.7</strong></div></td>
<td><select name="no.7">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.20">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.8</strong></div></td>
<td><select name="no.8">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.21">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.9</strong></div></td>
<td><select name="no.9">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.22">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.10</strong></div></td>
<td><select name="no.10">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name=no.23">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.11</strong></div></td>
<td><select name="no.11">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.24">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.12</strong></div></td>
<td><select name="no.12">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.25">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.13</strong></div></td>
<td><select name="no.13">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.26">
<option value="80">------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="69" colspan="3" bgcolor="#99FF99"><div align="center">
<form>
<label>
<input type="submit" name="frome1" value="save" />
<br />
</label>
<input type=button value="Refresh" onClick="javascript:location.reload();">
</form>
</div></td>
</tr>
</table>
<form id="form3" name="form3" method="post" action="">
</form>
<p> </p>
<p> </p>
</div>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p> </p>
</body>
</html>
Tag : PHP, CakePHP
|
|
|
|
|
|
Date :
2011-04-27 14:53:23 |
By :
sambeem001 |
View :
728 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่เข้าใจอะครับ คือ code ฐานข้อมูลอย่างไร ครับขอคำอธิบายเพิ่มเติมอีกนิดได้ป่าวครับว่าคุณต้องการอะไร
|
|
|
|
|
Date :
2011-04-27 14:56:48 |
By :
SOUL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก็คือ โค๊ด sql อะคับ ส่วนดค๊ดติดต่อฐานข้อมูลดาต้าเบรส มีอยู่ในนั้นแล้วครับ
|
|
|
|
|
Date :
2011-04-27 14:58:32 |
By :
sambeem001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|