|
 |
|
ทำไมทำหน้า insert.php กรอกข้อมูลในช่องแล้ว แต่มันไม่เข้าในฐานข้อมูลค่ะ |
|
 |
|
|
 |
 |
|
$sql = "insert into chinatopic Values('$name', '$cost', '$china');";
|
 |
 |
 |
 |
Date :
2009-09-11 19:29:28 |
By :
LOng |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$link = mysql_connect("localhost", "root", "admin");
mysql_query("Use chinadb;"); // แก้ไข mysql_select_db("chinadb",$link,);
mysql_query("set NAMES utf8"); // แก้ไข mysql_query("set NAMES utf-8");
$sql = "insert into chinatopic Values('$name', '$cost', '$china');";
// แก้ไข $sql = "insert into chinatopic Values ('$name', '$cost', '$china')";
$result = mysql_query($sql);
?>
|
 |
 |
 |
 |
Date :
2009-09-11 19:35:22 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$link = mysql_connect("localhost", "root", "admin");
mysql_select_db("chinadb",$link); // chinadb <-- ชื่อฐานข้อมูล
mysql_query("set NAMES utf-8");
$sql = "insert into chinatopic Values ('$name', '$cost', '$china')";
$result = mysql_query($sql);
?>
|
 |
 |
 |
 |
Date :
2009-09-11 19:37:17 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่แล้วมันไม่ได้อ่ะค่ะ ไม่เข้าเหมือนเดิม
|
 |
 |
 |
 |
Date :
2009-09-11 19:50:30 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไข
$sql = "insert into chinatopic Values ('".$_POST['name']."', '".$_POST['cost']."', '".$_POST['chinatopic']."')";
|
 |
 |
 |
 |
Date :
2009-09-11 19:55:19 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองทำแล้วค่ะ
ไม่ได้อีกแล้ว
|
 |
 |
 |
 |
Date :
2009-09-11 20:00:30 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขึ้น error อะไรเหรอครับ
|
 |
 |
 |
 |
Date :
2009-09-11 20:02:42 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขึ้น Error จาก print "Error"; อ่ะค่ะ
|
 |
 |
 |
 |
Date :
2009-09-11 20:09:05 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$picture มาจากไหน ครับ
|
 |
 |
 |
 |
Date :
2009-09-11 20:18:44 |
By :
DownsTream |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$user = "mt2k";
$password = "admin";
if (($user == "mt2k") && ($password == "admin"))
{
if(!$_POST['send'])
{
?>
<form method="post" action="<?=$PHP_SELF;?>">
<h3><b>เพิ่มรายการโปรแกรมทัวร์</b></h3><br>
Name: <input type="text" name="name"<br><p>
ราคา: <input type="text" name="cost"<br><p>
รายละเอียด: <input type="text" name="chinatopic"<br><p>
<input type="submit" Value="ตกลง" name="send">
</form>
<?
}
else
{
$link = mysql_connect("localhost", "root", "admin");
mysql_query("Use chinadb;");
mysql_query("set NAMES utf8");
$sql = "insert into chinatopic Values('".$_POST['name']."', '".$_POST['cost']."', '".$_POST['china']."');";
$result = mysql_query($sql);
if ($result)
{
echo "เพิ่มโปรแกรมได้<p>";
//mysql_close($link);
}
else
{
echo "ไม่สามารถเพิ่มได้<p>";
}
}
}
else
{
echo "invalid to entry the admin Page";
}
?>
ผมคิดว่าคุณคงต้องการแค่นี้ แต่ไปเอาโค้ดคนอื่นมา
|
 |
 |
 |
 |
Date :
2009-09-11 20:32:36 |
By :
DownsTream |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เด๊ยวจะลองดูค่ะ
|
 |
 |
 |
 |
Date :
2009-09-11 20:35:43 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โห้ ได้แล้วค่ะ เก่งม๊าก มาก ขอบคุณมากค่ะ
แต่ถามอีกอย่างนะค่ะ เพิ่มเข้าฐานข้อมูลได้แล้ว แต่ มันไม่โชว์เนื้อหาภาษาไทย ต้องทำไงค่ะ
|
 |
 |
 |
 |
Date :
2009-09-11 20:38:53 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อีกนิดค่ะ พอเข้าไปในฐานข้อมูลแล้ว แต่จะดู เนื้อความที่ใส่ เข้าไป ต้องเปิดที่ ลิ้งไหนค่ะ ขอบคุณอีกครั้งค่ะ
|
 |
 |
 |
 |
Date :
2009-09-11 20:40:57 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คำถามแรก
เพิ่ม <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
คำถามที่สอง งง ????
|
 |
 |
 |
 |
Date :
2009-09-11 21:01:30 |
By :
DownsTream |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ค่ะ ขอบคุณค่ะ
|
 |
 |
 |
 |
Date :
2009-09-11 21:21:18 |
By :
khanya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|