首页 > 解决方案 > 无法在 PHP MyAdmin SQL 中的表中插入多个(100+)行,程序生成的行

问题描述

我在 PHP MyAdmin 中有一个表,我想在表中插入一个示例数据。所以,我用 C++ 编写了一个程序,它返回了一个包含 1000 个插入查询的文件。但是,当我尝试在 PHP MyAdmin 上运行它时,它给出了错误。它确实插入了 20-30 行,有时甚至接近 50 行,但它从不插入所有行,并且每次都给出同样的错误,

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Chaman', 'Balochistan', 'death');
insert into patient (patient_id, p_name, p_ge' at line 1

我不明白,想知道可能是什么问题?我该如何解决这个问题?我可以根据解决方案重写我的程序。谢谢...

澄清一下,这就是文本文件中的插入查询很少的样子,

insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('1', 'Javed Ahsan', 'Male', 'House #59B, Ayub colony', 402669132, 94, 3000000007581, NULL, ' NULL, 'Chaman', 'Balochistan', 'death');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('2', 'Fareed Karim', 'Male', 'House #96B, Namamabad', 402662372, 41, 3000000022870, NULL, ' NULL, 'Muzafarabad', 'AJK', 'death');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('3', 'Kashif Hussein', 'Male', 'House #80B, Unasi', 402672716, 72, 3000000018409, NULL, ' NULL, 'Muzafarabad', 'AJK', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('4', 'Nadia Ayesha', 'Female', 'House #39B, Siddiqua Colony', 402685210, 17, 3000000015425, '3', NULL, 'Rahim yar khan', 'Punjab', 'ACTIVE');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('5', 'Ayesha Humaira', 'Female', 'House #20B, People colony', 402663040, 77, 3000000025766, '2', NULL, 'Mirpur', 'AJK', 'ACTIVE');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('6', 'Zara Lubna', 'Female', 'House #84B, Goli Mar', 402678875, 70, 3000000004732, NULL, ' NULL, 'Sahiwal', 'Punjab', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('7', 'Abeeha Musarrat', 'Female', 'House #79B, Ayub colony', 402684161, 57, 3000000003105, NULL, ' NULL, 'Sibi', 'Balochistan', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('8', 'Khalid Farhan', 'Male', 'House #76B, Bahria Town', 402678130, 63, 3000000000115, NULL, ' NULL, 'Bannu', 'KPK', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('9', 'Ayesha Bushra', 'Female', 'House #76B, Baldia Colony', 402673684, 59, 3000000006222, NULL, ' NULL, 'Jalabad', 'GB', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('10', 'Yasmin Seher', 'Female', 'House #87B, Careem Town', 402663547, 42, 3000000022760, NULL, ' NULL, 'Danyor', 'GB', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('11', 'Sadia Maria', 'Female', 'House #22B, Unasi', 402656552, 88, 3000000010410, NULL, ' NULL, 'Jehlum', 'Punjab', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('12', 'Hafsa Sidra', 'Female', 'House #84B, Gulberg', 402664013, 20, 3000000003814, NULL, '3', 'Peshawar', 'KPK', 'ACTIVE');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('13', 'Bano Faiza', 'Female', 'House #12B, Jhaal Kahanewaal', 402677345, 82, 3000000031644, NULL, '3', 'Sahiwal', 'Punjab', 'ACTIVE');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('14', 'Faraz Mahmoud', 'Male', 'House #27B, Gulshan Town', 402672852, 76, 3000000028060, NULL, ' NULL, 'Nowshera', 'KPK', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('15', 'Akmal Dalir', 'Male', 'House #7B, Goli Mar', 402681204, 87, 3000000008232, '1', NULL, 'Kotli', 'AJK', 'ACTIVE');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('16', 'Fahad Fahad', 'Male', 'House #42B, Mujeeb Town', 402680420, 61, 3000000028178, NULL, ' NULL, 'Mansehra', 'KPK', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('17', 'Milad Haris', 'Male', 'House #89B, Mujeeb Town', 402679110, 26, 3000000008477, NULL, ' NULL, 'Sahiwal', 'Punjab', 'discharged');
insert into patient (patient_id, p_name, p_gender, p_address, p_phone_no, p_age, p_CNIC, p_isolation_id, p_quarantine_id, p_city, p_province, p_status) VALUES('18', 'Irfan Farhan', 'Male', 'House #104B, Siddar', 402662027, 36, 3000000013988, NULL, '1', 'Quetta', 'Balochistan', 'ACTIVE');

标签: mysqlsql-insert

解决方案


推荐阅读