ขอคำแนะนำเรื่อง import ข้อมูล
Moderator: mindphp, ผู้ดูแลกระดาน
ขอคำแนะนำเรื่อง import ข้อมูล
ขอคำแนะนำเรื่อง import ข้อมูล จาก sql file เข้า database ด้วยค่ะ
ได้ลองทำดูแล้ว โดยการอ่านข้อมูลมาแล้ว qurey ทีละบรรทัด
ปรากฏว่า error ตั้งแต่บรรทัดแรกเลยค่ะ
ขอความกรุณาท่านผู้รู้ช่วยให้แนะนำด้วยนะคะ
ขอบคุณมากค่ะ..........................................................
ได้ลองทำดูแล้ว โดยการอ่านข้อมูลมาแล้ว qurey ทีละบรรทัด
ปรากฏว่า error ตั้งแต่บรรทัดแรกเลยค่ะ
ขอความกรุณาท่านผู้รู้ช่วยให้แนะนำด้วยนะคะ
ขอบคุณมากค่ะ..........................................................
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41358
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
ไม่ใช่แบบนี้ค่ะ คือต้องการเขียนสคริป php ค่ะmindphp เขียน:คำถามนี้น่าจะอยู่ที่บอร์ด
https://www.mindphp.com/modules.php?name ... forum&f=17
นะครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41358
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
ตัวอย่าง error นะคะ
# Host: localhost Database: database
# ------------------------------------------------------
#
# Table structure for table dentist
#
DROP TABLE IF EXISTS `dentist`;
CREATE TABLE `dentist` (
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
//------------------------------------------------------------------------------
และนี่ก็ตัวอย่าง sql file ค่ะ
# Host: localhost Database: database
# ------------------------------------------------------
#
# Table structure for table dentist
#
DROP TABLE IF EXISTS `dentist`;
CREATE TABLE `dentist` (
`dentistID` varchar(10) default NULL,
`dentistName` varchar(50) default NULL,
`D` int(11) default NULL
) TYPE=MyISAM;
#
# Dumping data for table dentist
#
INSERT INTO `dentist` VALUES ('001','Mr. A',NULL);
INSERT INTO `dentist` VALUES ('002','Mr. B',NULL);
INSERT INTO `dentist` VALUES ('003','Miss. C',NULL);
INSERT INTO `dentist` VALUES ('004','Mr. D',NULL);
INSERT INTO `dentist` VALUES ('005','Miss. E',NULL);
#
# Host: localhost Database: database
# ------------------------------------------------------
#
# Table structure for table dentist
#
DROP TABLE IF EXISTS `dentist`;
CREATE TABLE `dentist` (
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
//------------------------------------------------------------------------------
และนี่ก็ตัวอย่าง sql file ค่ะ
# Host: localhost Database: database
# ------------------------------------------------------
#
# Table structure for table dentist
#
DROP TABLE IF EXISTS `dentist`;
CREATE TABLE `dentist` (
`dentistID` varchar(10) default NULL,
`dentistName` varchar(50) default NULL,
`D` int(11) default NULL
) TYPE=MyISAM;
#
# Dumping data for table dentist
#
INSERT INTO `dentist` VALUES ('001','Mr. A',NULL);
INSERT INTO `dentist` VALUES ('002','Mr. B',NULL);
INSERT INTO `dentist` VALUES ('003','Miss. C',NULL);
INSERT INTO `dentist` VALUES ('004','Mr. D',NULL);
INSERT INTO `dentist` VALUES ('005','Miss. E',NULL);
#
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41358
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41358
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
สั่ง query ที่ ละ บันทัดไม่ได้ครับ
ต้อง ให้ จบ sql 1 คำสั่ง ถึง จะใช้ query ครั้งหนึ่ง
ถ้า ตามโค้ด ที่ แนะมา มันจะมี ค่า
mysql_query( '# Host: localhost Database: database ')
mysql_query( '# ------------------------------------------------------ ')
....
ต้องเขียนรวม คำสั่ง sql ให้ ครบ คำสั่ง ถึง query หนึ่งครั้ง
หรือ เปลี่ยนใช้ function อื่นๆ ในการ อ่านไฟล์
เช่น
file_get_contents
(PHP 4 >= 4.3.0, PHP 5)
file_get_contents -- Reads entire file into a string
ต้อง ให้ จบ sql 1 คำสั่ง ถึง จะใช้ query ครั้งหนึ่ง
ถ้า ตามโค้ด ที่ แนะมา มันจะมี ค่า
mysql_query( '# Host: localhost Database: database ')
mysql_query( '# ------------------------------------------------------ ')
....
ต้องเขียนรวม คำสั่ง sql ให้ ครบ คำสั่ง ถึง query หนึ่งครั้ง
หรือ เปลี่ยนใช้ function อื่นๆ ในการ อ่านไฟล์
เช่น
file_get_contents
(PHP 4 >= 4.3.0, PHP 5)
file_get_contents -- Reads entire file into a string
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: eange08, Google [Bot] และบุคลทั่วไป 127