Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > insert ไม่ลงฐานข้อมูลค่ะ มีการส่งค่าจากที่ผู้ใช้ป้อน แต่พอ insert แล้ว ไม่ได้ค่ะ ช่วยดูโค้ดให้หน่อยนะค่ะ มือใหม่ค่ะ



 

insert ไม่ลงฐานข้อมูลค่ะ มีการส่งค่าจากที่ผู้ใช้ป้อน แต่พอ insert แล้ว ไม่ได้ค่ะ ช่วยดูโค้ดให้หน่อยนะค่ะ มือใหม่ค่ะ

 



Topic : 072046



โพสกระทู้ ( 18 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



ไฟล์ add.php

<form id="form1" name="form1" method="post" action="display_add1.php">
<p>&nbsp;</p>
<table width="35%" height="543" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td height="38" colspan="2" bgcolor="#FFFFCC"><div align="center">รายละเอียดคำศัพท์ภาษาอังกฤษ</div></td>
</tr>
<tr>
<td width="39%" height="42"><div align="right">รหัสศัพท์อังกฤษ</div></td>
<td width="61%" bordercolor="#CCCCCC"><label><center>
<input type="text" name="txt_id" id="txt_id" />
</center></label></td>
</tr>
<tr>
<td height="55"><div align="right">คำศัพท์ภาษาอังกฤษ</div></td>
<td bordercolor="#CCCCCC"><Label><center><input type="text" name="txt_word" id="txt_word" /></center></Label></td>
</tr>
<tr>
<td height="51" colspan="2" bgcolor="#FFFFCC"><div align="center">
<p>รายละเอียดคำศัพท์ภาษาไทยถิ่น</p>
</div></td>
</tr>
<tr>
<td height="37"><div align="right">รหัสคำศัพท์ภาษาถิ่น</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="rural_id" id="rural_id" />
</center></label></td>
</tr>
<tr>
<td height="38"><div align="right">คำศัพท์ภาษาถิ่น</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="rural_word" id="rural_word" />
</center> </label></td>
</tr>
<tr>
<td height="41"><div align="right">คำอ่าน</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="read" id="read" />
</center></label></td>
</tr>
<tr>
<td height="38"><div align="right">ความหมาย</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="maining" id="maining" />
</center></label></td>
</tr>
<tr>
<td height="42"><div align="right">รหัสคำศัพท์ภาษาอังกฤษ</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="eng_id" id="eng_id" />
</center></label></td>
</tr>
<tr>
<td height="38"><div align="right">ภาค</div></td>
<td bordercolor="#CCCCCC"><label><center>
<select name="select" id="select">
<option value="01">ภาคเหนือ</option>
<option value="04">ภาคกลาง</option>
<option value="02">ภาคใต้</option>
<option value="03">ภาคตะวันออกเฉียงเหนือ</option>
</select>
</center></label></td>
</tr>
<tr>
<td height="60"><div align="right">ไฟล์เสียง</div></td>
<td bordercolor="#CCCCCC"><label><center>
<input type="text" name="sound" id="sound" />

<input type="submit" name="button" id="button" value="Browse" />
</center></label>
<label></label></td>
</tr>
<tr>
<td height="63" colspan="2"><div align="center">
<label></label>
<label><label></label>
</label>
<label>
<input type="submit" name="button2" id="button2" value="บันทึก" />
</label>
<label>
<input type="reset" name="button3" id="button3" value="ยกเลิก" />
</label>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>



ไฟล์ display_add1.php
<?php
include("connect.php");
$_POST['txt_id'];
$_POST['txt_word'];
echo $_POST['rural_id'];
echo $_POST['rural_word'];
echo $_POST['read'];
echo $_POST['maining'];
echo $_POST['eng_id'];
echo $_POST['select'];
echo $_POST['sound'];

if($_POST['txt_id']!="")
{
$sql="insert into eng(eng_id ,eng_word)values('".$_POST['txt_id']."','".$_POST['txt_word']."')";
$sqlquery=mysql_db_query($dbname, $sql);
}



if($_POST['rural_id']!="")
{
$sql1="insert into rural
(rural_id ,rural_word ,read ,maining ,eng_id ,zone_id,sound_id)
values
('".$_POST['rural_id']."','".$_POST['rural_word']."','".$_POST['read']."','".$_POST['maining']."','".$_POST['eng_id']."','".$_POST['select']."','".$_POST['sound']."')";
$sqlquery1=mysql_db_query($dbname, $sql1);
}
echo "<br> เพิ่มข้อมูลคำศัพท์ลงฐานข้อมูลเรียบร้อยแล้วค่ะ";
mysql_close();

?>


ผลจากการรันออกมาได้แบบนี้ค่ะ

10000000012rfrrfddssereer5e0000000042010000000012
เพิ่มข้อมูลคำศัพท์ลงฐานข้อมูลเรียบร้อยแล้วค่ะ


แต่พอเข้าไปดูในฐานไม่มีค่ะ
รบกวนหน่อยน่ะค่ะพอดีเป้นมือใหม่น่ะค่ะ



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-16 13:43:10 By : subai View : 1074 Reply : 4
 

 

No. 1

Guest


เอาไฟล์ connect มาดูหน่อยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 13:46:09 By : โปรแกรมเมอร์ฝึกหัด
 


 

No. 2



โพสกระทู้ ( 18 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ไฟล์ connect.php

<?
$host="localhost";
$user="root";
$pass="12345";
$dbname="rural_dic";
echo $link=mysql_connect($host,$user,$pass)or die("ติดต่อฐานข้อมูลไม่ได้");
mysql_select_db($dbname)or die("เลือกฐานข้อมูลไม่ได้");
$charset = "SET NAMES 'tis620'";
mysql_query($charset);
?>
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 13:48:04 By : subai
 

 

No. 3

Guest


ตอบความคิดเห็นที่ : 2 เขียนโดย : subai เมื่อวันที่ 2012-01-16 13:48:04
รายละเอียดของการตอบ ::
ตอนคุณ insert คุณลอง print $sql1 สิครับแล้วเอาไปรันใน phpmyadmin ว่ามานมี Error ไหม

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 13:53:56 By : โปรแกรมเมอร์ฝึกหัด
 


 

No. 4



โพสกระทู้ ( 18 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ทำได้แล้วค่ะ ขอบคุณมากน่ะค่ะที่ช่วยแนะนำค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-17 17:04:50 By : subai
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : insert ไม่ลงฐานข้อมูลค่ะ มีการส่งค่าจากที่ผู้ใช้ป้อน แต่พอ insert แล้ว ไม่ได้ค่ะ ช่วยดูโค้ดให้หน่อยนะค่ะ มือใหม่ค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่