รบกวนช่วยดูโค้ดให้หน่อยค่ะ error ขึ้นว่า No database selected ค่ะ
โค้ดค่ะ
Code (PHP)
<?
include("connect.php");
$skin_name = $_POST['skin_name'];
$crop_name = $_POST['crop_name'];
$stature = $_POST['stature'];
$shoulder = $_POST['shoulder'];
$waistline = $_POST['waistline'];
$bust = $_POST['bust'];
$hip = $_POST['hip'];
$sql1 = "INSERT INTO skin_type (skin_name) VALUE ($_POST[ 0 , 'skin_name' ]) " ;
mysql_query("set names tis620");
if(mysql_query($sql)){
$sql2 = "INSERT INTO crop_type (crop_name) VALUE (($_POST[ 0 , 'crop_name'])";
mysql_query("set names tis620");
if(mysql_query($sql)){
$sql3 = "INSERT INTO customer_model (set_model_id, model_id, skin_id,hip, bust, waistline,stature ,shoulder , crop_id, cus_id) VALUE (0, null, null, $_POST['hip'], $_POST['bust'], $_POST['waistline'] , $_POST['stature'], $_POST['shoulder'], null, null)";
mysql_query("set names tis620");
if(mysql_query($sql)){
echo "<br>";
die(" Error");
}else{
//echo "<br>";
echo "seccuss";
}
?>
ชื่อดาต้าเบส รหัสก็ตรงกันอ่ะค่ะ แล้วมัน error ตรงไหนอ่ะค่ะTag : PHP, MySQL
Date :
2012-03-11 17:38:00
By :
moome
View :
1114
Reply :
4
เอาโค้ดมาผิดอันค่ะ อันที่ error ตัวนี้ค่ะ
Code (PHP)
<?
$skin_name= $_REQUEST['skin_name'];
$crop_name=$_REQUEST['crop_name'];
$stature =$_REQUEST['stature'];
$shoulder =$_REQUEST['shoulder'];
$waistline =$_REQUEST['waistline'];
$bust= $_REQUEST['bust'];
$hip=$_REQUEST['hip'];
$host="localhost";
$user="root";
$pw="123456";
$dbname="cwatcharaporn";
$c = mysql_connect($host,$user,$pw);
if (!$c) {
echo "<h3>ERROR </h3>";
exit();
}
mysql_query("set NAMES tis620");
$sql="INSERT INTO skin_type(skin_name) VALUE (0, '$skin_name)";
mysql_query($sql) or die (mysql_error());
$sql="INSERT INTO crop_type(crop_name) VALUE (0, '$crop_name)";
mysql_query($sql) or die (mysql_error());
$sql="INSERT INTO custormer_model(hip, bust, waistkine, stature, shoulder) VALUE ('$stature', '$shoulder', '$waistline', '$bust', '$hip')";
mysql_query($sql) or die (mysql_error());
echo $sql;
?>
Date :
2012-03-11 17:41:02
By :
moome
ลืมคำสั่ง mysql_select_db() ครับ
Code (PHP)
$host="localhost";
$user="root";
$pw="123456";
$dbname="cwatcharaporn";
$c = mysql_connect($host,$user,$pw);
if (!$c) {
echo "<h3>ERROR </h3>";
exit();
}
mysql_select_db($dbname);
Date :
2012-03-11 20:41:00
By :
webmaster
แก้ได้แล้วค่ะ ขอบคุณค่ะ
Date :
2012-03-12 19:56:40
By :
moome
Load balance : Server 05