ขอคำแนะนำเรื่อง import ข้อมูล
Moderators: mindphp, ผู้ดูแลกระดาน
ขอคำแนะนำเรื่อง import ข้อมูล
ขอคำแนะนำเรื่อง import ข้อมูล จาก sql file เข้า database ด้วยค่ะ
ได้ลองทำดูแล้ว โดยการอ่านข้อมูลมาแล้ว qurey ทีละบรรทัด
ปรากฏว่า error ตั้งแต่บรรทัดแรกเลยค่ะ
ขอความกรุณาท่านผู้รู้ช่วยให้แนะนำด้วยนะคะ
ขอบคุณมากค่ะ..........................................................
ได้ลองทำดูแล้ว โดยการอ่านข้อมูลมาแล้ว qurey ทีละบรรทัด
ปรากฏว่า error ตั้งแต่บรรทัดแรกเลยค่ะ
ขอความกรุณาท่านผู้รู้ช่วยให้แนะนำด้วยนะคะ
ขอบคุณมากค่ะ..........................................................
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 26646
- Joined: 22/09/2008 6:18 pm
- Contact:
ไม่ใช่แบบนี้ค่ะ คือต้องการเขียนสคริป php ค่ะmindphp wrote:คำถามนี้น่าจะอยู่ที่บอร์ด
https://www.mindphp.com/modules.php?name ... forum&f=17
นะครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 26646
- Joined: 22/09/2008 6:18 pm
- Contact:
ตัวอย่าง 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
- Posts: 26646
- Joined: 22/09/2008 6:18 pm
- Contact:
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 26646
- Joined: 22/09/2008 6:18 pm
- Contact:
สั่ง 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
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1 Replies
- 626 Views
-
Last post by mindphp
27/03/2016 11:12 pm
-
-
ตัวอย่าง การ Import ข้อมูล แทนข้อมูลเดิม Xampp and Appserv By nss.nososad
by nososad » 14/08/2014 5:07 pm » in Linux - Web Server - 0 Replies
- 1076 Views
-
Last post by nososad
14/08/2014 5:07 pm
-
Who is online
Users browsing this forum: Google [Bot] and 11 guests