|
|
|
ช่วยหน่อยนะค่ะ บันทึกข้อมูลลงฐานไม่ได้อ่ะค่ะ ช่วยดู code หน่อยนะค่ะ ว่าผิดตรงไหนทำไหมไม่ลงฐาน |
|
|
|
|
|
|
|
ช่วยดู code หน่อยนะค่ะ ว่าผิดตรงไหน
ทำไหมไม่ลงฐาน
save.php
<html>
<body>
<form name="form1" method="get" action="show.php">
<p>CardNum
<input type="text" name="CardNum ">
CardMode
<select name="CardMode ">
<option value="0">Invalid</option>
<option value="1">Card Only</option>
<option value="2">Card and Password</option>
<option value="3">CArd or Password</option>
</select>
</p>
<p>CardPword
<input type="text" name="CardPword">
Name
<input type="text" name="name">
</p>
<p> Department
<input type="text" name="Department ">
TimeZone
<select name="TimeZone ">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
<option value="60">60</option>
<option value="61">61</option>
</select>
</p>
<p>DoorGroup
<input type="text" name="DoorGroup ">
Elevator Control
<select name="Elevator Control">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
<option value="60">60</option>
<option value="61">61</option>
<option value="62">62</option>
<option value="63">63</option>
<option value="64">64</option>
<option value="65">65</option>
<option value="66">66</option>
<option value="67">67</option>
<option value="68">68</option>
<option value="69">69</option>
<option value="70">70</option>
<option value="71">71</option>
<option value="72">72</option>
<option value="73">73</option>
<option value="74">74</option>
<option value="75">75</option>
<option value="76">76</option>
<option value="77">77</option>
<option value="78">78</option>
<option value="79">79</option>
<option value="80">80</option>
<option value="81">81</option>
<option value="82">82</option>
<option value="83">83</option>
<option value="84">84</option>
<option value="85">85</option>
<option value="86">86</option>
<option value="87">87</option>
<option value="88">88</option>
<option value="89">89</option>
<option value="90">90</option>
<option value="91">91</option>
<option value="92">92</option>
<option value="93">93</option>
<option value="94">94</option>
<option value="95">95</option>
<option value="96">96</option>
<option value="97">97</option>
<option value="98">98</option>
<option value="99">99</option>
<option value="100">100</option>
<option value="101">101</option>
<option value="102">102</option>
<option value="103">103</option>
<option value="104">104</option>
<option value="105">105</option>
<option value="106">106</option>
<option value="107">107</option>
<option value="108">108</option>
<option value="109">109</option>
<option value="110">110</option>
<option value="111">111</option>
<option value="112">112</option>
<option value="113">113</option>
<option value="114">114</option>
<option value="115">115</option>
<option value="116">116</option>
<option value="117">117</option>
<option value="118">118</option>
<option value="119">119</option>
<option value="120">120</option>
<option value="121">121</option>
<option value="122">122</option>
<option value="123">123</option>
<option value="124">124</option>
<option value="125">125</option>
<option value="126">126</option>
<option value="127">127</option>
<option value="128">128</option>
<option value="129">129</option>
<option value="130">130</option>
<option value="131">131</option>
<option value="132">132</option>
<option value="133">133</option>
<option value="134">134</option>
<option value="135">135</option>
<option value="136">136</option>
<option value="137">137</option>
<option value="138">138</option>
<option value="139">139</option>
<option value="140">140</option>
<option value="141">141</option>
<option value="142">142</option>
<option value="143">143</option>
<option value="144">144</option>
<option value="145">145</option>
<option value="146">146</option>
<option value="147">147</option>
<option value="148">148</option>
<option value="149">149</option>
<option value="150">150</option>
<option value="151">151</option>
<option value="152">152</option>
<option value="153">153</option>
<option value="154">154</option>
<option value="155">155</option>
<option value="156">156</option>
<option value="157">157</option>
<option value="158">158</option>
<option value="159">159</option>
<option value="160">160</option>
<option value="161">161</option>
<option value="162">162</option>
<option value="163">163</option>
<option value="164">164</option>
<option value="165">165</option>
<option value="166">166</option>
<option value="167">167</option>
<option value="168">168</option>
<option value="169">169</option>
<option value="170">170</option>
<option value="171">171</option>
<option value="172">172</option>
<option value="173">173</option>
<option value="174">174</option>
<option value="175">175</option>
<option value="176">176</option>
<option value="177">177</option>
<option value="178">178</option>
<option value="179">179</option>
<option value="180">180</option>
<option value="181">181</option>
<option value="182">182</option>
<option value="183">183</option>
<option value="184">184</option>
<option value="185">185</option>
<option value="186">186</option>
<option value="187">187</option>
<option value="188">188</option>
<option value="189">189</option>
<option value="190">190</option>
<option value="191">191</option>
<option value="192">192</option>
<option value="193">193</option>
<option value="194">194</option>
<option value="195">195</option>
<option value="196">196</option>
<option value="197">197</option>
<option value="198">198</option>
<option value="199">199</option>
<option value="200">200</option>
<option value="201">201</option>
<option value="202">202</option>
<option value="203">203</option>
<option value="204">204</option>
<option value="205">205</option>
<option value="206">206</option>
<option value="207">207</option>
<option value="208">208</option>
<option value="209">209</option>
<option value="210">210</option>
<option value="211">211</option>
<option value="212">212</option>
<option value="213">213</option>
<option value="214">214</option>
<option value="215">215</option>
<option value="216">216</option>
<option value="217">217</option>
<option value="218">218</option>
<option value="219">219</option>
<option value="220">220</option>
<option value="221">221</option>
<option value="222">222</option>
<option value="223">223</option>
<option value="224">224</option>
<option value="225">225</option>
<option value="226">226</option>
<option value="227">227</option>
<option value="228">228</option>
<option value="229">229</option>
<option value="230">230</option>
<option value="231">231</option>
<option value="232">232</option>
<option value="234">234</option>
<option value="235">235</option>
<option value="236">236</option>
<option value="237">237</option>
<option value="238">238</option>
<option value="239">239</option>
<option value="240">240</option>
<option value="241">241</option>
<option value="242">242</option>
<option value="243">243</option>
<option value="244">244</option>
<option value="245">245</option>
<option value="246">246</option>
<option value="247">247</option>
<option value="248">248</option>
<option value="249">249</option>
<option value="250">250</option>
<option value="251">251</option>
<option value="252">252</option>
<option value="253">253</option>
<option value="254">254</option>
<option value="255">255</option>
</select>
</p>
<p>CardCode
<input type="text" name="CardCode ">
Picture
<input type="text" name=" Picture ">
</p>
<p>Remark
<input type="text" name="Remark">
EmployeeId
<input type="text" name="EmployeeId">
</p>
<p>SociaId
<input type="text" name="SociaId">
CardExpire
<select name="CardExpire">
<option value="0">0</option>
<option value="1">1</option>
</select>
Day
<select name="Day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
Mont
<select name="Mont">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
Year
<input type="text" name="Year">
AntiPass
<select name="AntiPass">
<option value="0">0</option>
<option value="1">1</option>
</select>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
show.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body>
<?
$dsn_name = "Card";
$username ="";
$password ="";
$connect= odbc_connect($dsn_name, $username, $password) or die("ติดต่อ DSN ไม่ได้");
/* จะเห็นว่า code ข้างล่างไม่ได้มีการเพิ่มฟิวส์ id เพราะ id ชนิดของข้อมูลเป็น Auto number */
$sql = "insert into Card (CardNum,CardMode,CardPword,Name,Department,TimeZone,DoorGroup,Ec,CardCode,Picture,Remark,EmployeeId,SocialId,UserA,UserB,Vdg,CardExpire,CardExpireYear,CardExpireMonth,CardExpireDay,AntiPass) values ('".$CardNum."','".$CardMode."','".$CardPword."','".$Name."','".$Department."','".$TimeZone."','".$DoorGroup."','".$Ec."','".$CardCode."','".$Picture."','".$Remark."','".$EmployeeId."','".$SocialId."','".$UserA."','".$UserB."','".$Vdg."','".$CardExpire."','".$CardExpireYear."','".$CardExpireMonth."','".$CardExpireDay."','".$AntiPass."')";
echo $sql;
$execute = odbc_exec($connect, $sql) or die ("เอ็กซิคิวส์คำสั่งไม่ได้");
odbc_free_result($execute);
$sql = "select * from Card";
$execute = odbc_exec($connect, $sql) or die ("เอ็กซิคิวส์คำสั่งไม่ได้");
?>
<table border="1" width="371">
<tr>
<td width="32">
<div align="center">CardNum</div>
</td>
<td width="132">
<div align="center">CardMode</div>
</td>
<td width="185">
<div align="center">CardPword</div>
</td>
<td width="185">
<div align="center">Name</div>
</td>
<td width="185">
<div align="center">Department</div>
</td>
<td width="185">
<div align="center">TimeZone</div>
</td>
<td width="185">
<div align="center">DoorGroup</div>
</td>
<td width="185">
<div align="center">Ec</div>
</td>
<td width="185">
<div align="center">Cardcode</div>
</td>
<td width="185">
<div align="center">Picture</div>
</td>
<td width="185">
<div align="center">Remark</div>
</td>
<td width="185">
<div align="center">EmployeeId</div>
</td>
<td width="185">
<div align="center">SocialId</div>
</td>
<td width="185">
<div align="center">UserA</div>
</td>
<td width="185">
<div align="center">UserB</div>
</td>
<td width="185">
<div align="center">Vdg</div>
</td>
<td width="185">
<div align="center">CardExpire</div>
</td>
<td width="185">
<div align="center">CardExpireYear</div>
</td>
<td width="185">
<div align="center">CardExpireMonth</div>
</td>
<td width="185">
<div align="center">CardExpireDay</div>
</td>
<td width="185">
<div align="center">Antipass</div>
</td>
</tr>
</table>
<?
$i=1;
while(odbc_fetch_row($execute,$i))
{
$CardNum=odbc_result($execute,"CardNum");
$CardMode=odbc_result($execute,"CardMode");
$CardPword=odbc_result($execute,"CardPword");
$Name=odbc_result($execute,"Name");
$Department=odbc_result($execute,"Department");
$TimeZone=odbc_result($execute,"TimeZone");
$DoorGroup=odbc_result($execute,"DoorGroup");
$Ec=odbc_result($execute,"Ec");
$CardCode=odbc_result($execute,"CardCode");
$Picture=odbc_result($execute,"Picture");
$Remark=odbc_result($execute,"Remark");
$EmployeeId=odbc_result($execute,"EmployeeId");
$SocialId=odbc_result($execute,"SocialId");
$UserA=odbc_result($execute,"UserA");
$UserB=odbc_result($execute,"UserB");
$Vdg=odbc_result($execute,"Vdg");
$CardExpire=odbc_result($execute,"CardExpire");
$CardExpireYear=odbc_result($execute,"CardExpireYear");
$CardExpireMont=odbc_result($execute,"CardExpireMonth");
$CardExpireDay=odbc_result($execute,"CardExpireDay");
$AntiPass=odbc_result($execute,"AntiPass");
?>
<table border="1" width="1554">
<tr>
<td width="70">
<div align="center">
<? echo "$CardNum"; ?>
</div>
</td>
<td width="69">
<? echo "$CardMode"; ?>
</td>
<td width="80">
<? echo "$CardPword"; ?>
</td>
<td width="41">
<? echo "$Name"; ?>
</td>
<td width="85">
<? echo "$Department"; ?>
</td>
<td width="69">
<? echo "$TimeZone"; ?>
</td>
<td width="81">
<? echo "$DoorGroup"; ?>
</td>
<td width="23">
<? echo "$Ec"; ?>
</td>
<td width="68">
<? echo "$CardCode"; ?>
</td>
<td width="50">
<? echo "$Picture"; ?>
</td>
<td width="54">
<? echo "$Remark"; ?>
</td>
<td width="85">
<? echo "$EmployeeId"; ?>
</td>
<td width="55">
<? echo "$SocialId"; ?>
</td>
<td width="47">
<? echo "$UserA"; ?>
</td>
<td width="46">
<? echo "$UserB"; ?>
</td>
<td width="31">
<? echo "$Vdg"; ?>
</td>
<td width="74">
<? echo "$CardExpire"; ?>
</td>
<td width="112">
<? echo "$CardExpireYear"; ?>
</td>
<td width="116">
<? echo "$CardExpireMonth"; ?>
</td>
<td width="106">
<? echo "$CardExpireDay"; ?>
</td>
<td width="62">
<? echo "$AntiPass"; ?>
</td>
</tr>
</table>
<?
$i++;
}
?>
<?
odbc_close($connect);
?>
</body>
</html>
Tag : - - - -
|
|
|
|
|
|
Date :
24 ก.ย. 2550 12:03:34 |
By :
เก๋ |
View :
1335 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(CardNum,CardMode,CardPword,Name,Department,TimeZone,DoorGroup,Ec,CardCode,Picture,Remark,EmployeeId,SocialId,UserA,UserB,Vdg,CardExpire,CardExpireYear,CardExpireMonth,CardExpireDay,AntiPas
ตรวจสอบตัว แปรดูว่าตัวไหนซ้ำกับคำสงวนบ้าง เช่น คำว่า remark อาจจะซ้ำกับคำในฐานข้อมูล
จ้าว สู้ๆๆ จ้าว
|
|
|
|
|
Date :
24 ก.ย. 2550 13:37:42 |
By :
คนเหนือเจ้า |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|