 |
[PHP]
ช่วยหน่อยเถอะค่ะ ยังไงก็ไม่ลง database ไม่รู้ผิดตรงไหน |
|
 |
|
|
 |
 |
|
<?
include("connect.php");
$tb= "employee";
$connect= mysql_connect ($host,$user,$password) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ ");
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้");
$sSql=" INSERT INTO $tb (leadname,emp_name,emp_add,emp_city,emp_zip,emp_tel,emp_mobile,emp_email,
job_major,emp_position,emp_salary,emp_needjob,emp_location)";
$Sql=$sSql."values('$leadname','$emp_name','$emp_add','$emp_city','$emp_zip','$emp_tel','$emp_mobile','$emp_email',
'$job_major','$emp_position','$emp_salary','$emp_needjob','$emp_location')" or die ("Add ข้อมูลลง Table ไม่ได้ ");
$dbquery = mysql_db_query($db, $Sql);
$result.= mysql_query($Sql);
echo $Sql; //แสดงข้อมูลที่ทำการ add ลง table b*/
//ปิดการติดต่อกับฐานข้อมูล//
mysql_close($connect);
echo "<font face=\"MS Sans Serif\" size=\"2\"><b><center>เพิ่มข้อมูลเรียบร้อย !!</center></b></font>";
echo "<font face=\"MS Sans Serif\" size=\"2\"><b><center>Insert data successfully !!</center></b></font>";
echo "<meta http-equiv=refresh content ='3;url=employee_detail.php'>";
?>
ช่วยหน่อยเถอะค่ะ เอาตัวอย่างมาจากตัวที่สามารถแอดลงฐานข้อมูลได้เลยนะค่ะ แต่พอมาเปลี่ยนตัวแปลเท่านั้นเองยังไง ๆ ก็ไม่ลง ไม่รู้ผิดตรงไหน
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
1 มี.ค. 2549 15:12:51 |
By :
leejank |
View :
2279 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
include("connect.php");
include ไฟล์นี้มาใช้ แล้วมีรึยังคับ ถ้ามีแล้วขอดูหน่อย
*********************
|
 |
 |
 |
 |
Date :
2 มี.ค. 2549 09:09:28 |
By :
boy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็ทำการ include มาแล้วนี่ค่ะ บรรทัดแรกเลยอ่ะค่ะ
|
 |
 |
 |
 |
Date :
2 มี.ค. 2549 09:14:29 |
By :
leejank |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$host = "localhost";
$user= "root";
$password = "";
$db = "job";
function Conn2DB()
{
global $Link;
global $host;
global $user;
global $password;
global $db;
$Link = mysql_connect($host,$user,$password) or die("ไม่สามารถติดต่อกับ MySql ได้");
mysql_select_db($db,$Link) or die ("ไม่สามารถเลือกใช้ฐานข้อมูลได้");
}
function CloseDB()
{
global $Link;
mysql_close($Link);
}
?>
*********************************************************************************************************************
นี่อ่ะค่ะไฟล์ connect อีกไฟล์หนึ่งที่ทำก็ลง Database นี่ค่ะ
แล้วขอถามเพิ่มเลยนะค่ะ ไฟล์ที่ทำเป็น array จะเก็บลงฐานข้อมูลยังไงค่ะ
|
 |
 |
 |
 |
Date :
2 มี.ค. 2549 09:23:42 |
By :
leejank |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองไป ไล่ดู ชื่อฟิลด์ ที่คำสั่ง sql กับ ที่เทเบิล job ดูดีๆว่ามันตรงกันรึป่าวนะครับ
ถ้ารูปแบบคำสั่งไม่ผิดนะครับ
ส่วนนี้จะผิดได้บ่อยๆเพราะมันเยอะด้วยมั้งครับ ตาลาย
|
 |
 |
 |
 |
Date :
2 มี.ค. 2549 14:04:41 |
By :
ggolem01th |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แงงงงงงงงงงงงงงงงง
เขียน jsp ติดต่อ database อยู่งับ ม่ายลงเหมือนกานนนนนน
เศร้าๆๆๆๆๆ
แงงงงงงงงงงงงงงงงงงงงงงงงงงงงงงง...
|
 |
 |
 |
 |
Date :
24 ก.ค. 2551 23:31:44 |
By :
แงงงงงงงงงง |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|