|
 |
|
checkและINSERTในหน้าเดียวกันมันerrorช่วยผมทีคับต้องทำยังไง |
|
 |
|
|
 |
 |
|
check ข้อมูลและINSERTในหน้าเดียวกันคลิปที่ปุ่มตรวจสอบถ้ามีข้อมูลIDที่ตรวจสอบแล้วก็ให้โชว์ข้อมูลตามtextต้องเขียนแบบไหนอ่ะคับ ผมเขียนแบบนี้อ่ะคับมันerrorมึนคิดไม่ออก
<form id="applymember" name="applymember" method="post" action="" onSubmit="return checkapplymember();">
<table width="822" border="0">
<tr>
<td height="34" class="style23"><div align="right">รหัสสมาชิก:</div></td>
<td><input name="IDMember" type="text" style="font-family: Comic Sans MS" id="IDMember4" size="10" maxlength="9" />
<span class="style10">
<span class="style1">*</span>
<input type="submit" name="button" id="button" value="ตรวจสอบ" class="content03" style="font-weight:bold;" />
<?php
include("config.php");
mysql_query("SET NAMES 'tis620'");
$sql = "select admin_username from admin where IDMember='$IDMember'" ;
$table = mysql_query($sql,$conn) or die("ไม่สามารถติดต่อฐานข้อมูลได้");
$numrow = mysql_num_rows($table);
if($numrow!=0){
echo "มีผู้ใช้IDนี้แล้ว"
}
else{
$sql = "INSERT INTO applymember
(IDMember , pwmember , DayApply , names, people, birthday,address, province, phon, Bookbank ,bankAccount ,Padvise ,Nadvise ,Pup ,Nup,beside )
VALUES
('$IDMember' , '$pwmember' , '$DayApply','$names', '$people','$birthday', '$address', '$province', '$phon', '$Bookbank', '$bankAccount', '$Padvise', '$Nadvise', '$Pup','$Nup','$beside')";
mysql_query($sql, $conn);
}
mysql_close();
?>
</span></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="34" class="style23"><div align="right"> รหัสผ่าน:</div></td>
<td align="left" valign="top">
<input name="pwmember" type="text" style="font-family: Comic Sans MS" id="pwMember2" size="6" maxlength="6" />
<span class="style1">*</span> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td width="176" height="30" class="style29"><div align="right" class="style23"><span class="style7">วันที่สมัค</span>ร: </div></td>
<td width="237"><input name="DayApply" type="text" style="font-family: Comic Sans MS" id="DayApply2" size="10" maxlength="10" value="<?php echo $record['DayApply'];?>" />
<span class="style1">*</span></td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td height="31" class="style3"><div align="left" class="style23">
<div align="right" class="style23">ชื่อ-นามสกุล:</div>
</div>
</div></td>
<td><input name="names" type="text" style="font-family: Comic Sans MS" id="names" size="30" maxlength="50" value="<?php echo $record['names'];?> " />
<span class="style1">*</span></td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td height="31"><div align="right"><span class="style23">เลขประจำตัวประชาชน:</span></div></td>
<td><input name="people" type="text" style="font-family: 'Comic Sans MS' id="people" size="15" maxlength="13" value="<?php echo $record['people'];?> " />
<span class="style1">*</span></td>
<td class="style23"> </td>
<td colspan="2" class="style3"> </td>
</tr>
<tr>
<td height="32"><div align="right"><span class="style23">ว/ด/ป เกิด: </span></div></td>
<td><span class="style3">
<input name="birthday" type="text" style="font-family: 'Comic Sans MS' id="birthday" size="10" maxlength="10" value="<?php echo $record['birthday'];?> " />
</span></td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td height="79"><div align="right"><span class="style3"><span class="style23">ที่อยู่: </span></span></div></td>
<td bgcolor="#C6EEA7"><span class="style3">
<textarea name="address" cols="29" rows="4" style="font-family: 'Comic Sans MS' id="address="address"value="<?php echo $record['address'];?>" ><?php echo $record['address'];?></textarea>
<span class="style1">*</span></span></td>
<td width="96" class="style3"> </td>
<td colspan="2" valign="top"><label for="radiobutton"></label>
<label for="radio"></label>
<span class="style3">
<br />
<input type="submit" name="submit" id="submit" value=" บันทึก " class="content03" />
<input name="Delete" type="reset" id="Delete" value="ลบ" />
</span></td>
</tr>
<tr>
<td height="34"><div align="right"><span class="style23">จังหวัด-รหัสไปรษณี: </span></div></td>
<td><span class="style3">
<input name="province" type="text" style="font-family: 'Comic Sans MS' id="province" size="30" maxlength="35" value="<?php echo $record['province'];?>" />
<span class="style1">*</span></span></td>
<td><div align="right"></div></td>
<td colspan="2"><div align="left"></div></td>
</tr>
<tr>
<td height="38" class="style3"><div align="right" class="style23">
<div align="right">เบอร์โทร:</div>
</div></td>
<td><input name="Phon" type="text" style="font-family: Comic Sans MS" id="Phon" size="30" maxlength="50" value="<?php echo $record['phon'];?>" /></td>
<td><label for="imageField"></label></td>
<td width="179"> </td>
<td width="112"> </td>
</tr>
<tr>
<td height="33" class="style3"><div align="right" class="style23">
<div align="right">ธนาคาร-สาขา:</div>
</div></td>
<td><input name="Bookbank" type="text" style="font-family: Comic Sans MS" id="Bookbank3" size="30" maxlength="40" value="<?php echo $record['Bookbank'];?>" /></td>
<td><div align="right"></div></td>
<td><div align="center"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td height="31" class="style23"><div align="right">เลขที่บัญชี:</div></td>
<td><input name="BankAccount" type="text" style="font-family: Comic Sans MS" id="BankAccount4" size="13" maxlength="13" value= "<?php echo $record['bankAccount'];?>" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
ขอบคุณคับผม
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-07-30 12:08:03 |
By :
gofgof |
View :
972 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code
$sql = "INSERT INTO applymember
(IDMember , pwmember , DayApply , names, people, birthday,address, province, phon, Bookbank ,bankAccount ,Padvise ,Nadvise ,Pup ,Nup,beside )
VALUES
('$IDMember' , '$pwmember' , '$DayApply','$names', '$people','$birthday', '$address', '$province', '$phon', '$Bookbank', '$bankAccount', '$Padvise', '$Nadvise', '$Pup','$Nup','$beside')";
ลองตรวจสอบค่าตัวแปรที่จะ Insert ครับ
|
 |
 |
 |
 |
Date :
2009-07-30 12:59:03 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณคับผมจะลองดูไม่ได้จะรบกวนถามไหมคับ ขอบคุณคับ
|
 |
 |
 |
 |
Date :
2009-07-30 13:09:28 |
By :
gofgof |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เดิมที่ INSERTได้คับพอผมเพิ่มfunctionตรวจสอบมาตามโคว์นี้คับ
$sql = "select admin_username from admin where IDMember='$IDMember'" ;
$table = mysql_query($sql,$conn) or die("ไม่สามารถติดต่อฐานข้อมูลได้");
$numrow = mysql_num_rows($table);
if($numrow!=0){
echo "มีผู้ใช้IDนี้แล้ว"
}
else{
และใส่"<?php echo $record['ฟิลด์'];?>"ในtext box เพื่อคลิกตรวจสอบแล้วนำข้อมูลในฐานข้อมูลมาโชว์ในtext box พอรันมาerrorว่า
Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\AppServ\www\Admin\Applymember.php on line 124
|
 |
 |
 |
 |
Date :
2009-07-30 13:31:19 |
By :
gofgof |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo "มีผู้ใช้IDนี้แล้ว"
เซมิโคล่อนด้วยครับ
|
 |
 |
 |
 |
Date :
2009-07-30 13:59:41 |
By :
rasabut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|