473,813 Members | 3,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT problem

I am trying to populate a table with the following insert query run
through phpmyadmin. When I attempt to run it phpmyadmin just freezes.
After a while "Fatal error: Maximum execution time of 300 seconds
exceeded in /web/myadmin/283/libraries/import.lib.php on line 19"
appears but no indication as why the command fails. Any advice most
welcome.

INSERT INTO `countries` ( `id` , `country` ) VALUES ('1',
'Abkhazia'), ('2', 'Afghanistan'), ('3', 'Akrotiri and Dhekelia'),
('4', 'Åland'), ('5', 'Albania'), ('6', 'Algeria'), ('7', 'American
Samoa'), ('8', 'Andorra'), ('9', 'Angola'), ('10', 'Anguilla'), ('11',
'Antigua and Barbuda '), ('12', 'Argentina'), ('13', 'Armenia'),
('14', 'Aruba'), ('15', 'Ascension Island'), ('16', 'Australia'),
('17', 'Austria'), ('18', 'Azerbaijan'), ('19', 'Bahamas, The'),
('20', 'Bahrain'), ('21', 'Bangladesh'), ('22', 'Barbados '), ('23',
'Belarus'), ('24', 'Belgium'), ('25', 'Belize '), ('26', 'Benin'),
('27', 'Bermuda'), ('28', 'Bhutan'), ('29', 'Bolivia'), ('30', 'Bosnia
and Herzegovina'), ('31', 'Botswana'), ('32', 'Brazil'), ('33',
'Brunei'), ('34', 'Bulgaria'), ('35', 'Burkina Faso '), ('36',
'Burundi'), ('37', 'Cambodia'), ('38', 'Cameroon'), ('39', 'Canada'),
('40', 'Cape Verde'), ('41', 'Cayman Islands'), ('42', 'Central
African Republic'), ('43', 'Chad'), ('44', 'Chile'), ('45', 'China'),
('46', 'Christmas Island'), ('47', 'Cocos Islands'), ('48',
'Colombia'), ('49', 'Comoros'), ('50', 'Congo, Democratic Republic
of'), ('51', 'Congo, Republic of'), ('52', 'Cook Islands'), ('53',
'Costa Rica'), ('54', 'Côte d'Ivoire'), ('55', 'Croatia'), ('56',
'Cuba'), ('57', 'Cyprus'), ('58', 'Czech Republic'), ('59',
'Denmark'), ('60', 'Djibouti'), ('61', 'Dominica'), ('62', 'Dominican
Republic '), ('63', 'Ecuador'), ('64', 'Egypt'), ('65', 'El
Salvador'), ('66', 'Equatorial Guinea'), ('67', 'Eritrea'), ('68',
'Estonia'), ('69', 'Ethiopia'), ('70', 'Falkland Islands'), ('71',
'Faroe Islands'), ('72', 'Fiji'), ('73', 'Finland'), ('74', 'France'),
('75', 'French Polynesia'), ('76', 'Gabon'), ('77', 'Gambia, The'),
('78', 'Georgia'), ('79', 'Germany'), ('80', 'Ghana'), ('81',
'Gibraltar'), ('82', 'Greece'), ('83', 'Greenland'), ('84', 'Grenada
'), ('85', 'Guam'), ('86', 'Guatemala'), ('87', 'Guernsey'), ('88',
'Guinea'), ('89', 'Guinea-Bissau'), ('90', 'Guyana'), ('91', 'Haiti'),
('92', 'Honduras'), ('93', 'Hong Kong'), ('94', 'Hungary'), ('95',
'Iceland'), ('96', 'India'), ('97', 'Indonesia'), ('98', 'Iran'),
('99', 'Iraq'), ('100', 'Ireland'), ('101', 'Isle of Man'), ('102',
'Israel'), ('103', 'Italy'), ('104', 'Jamaica '), ('105', 'Japan '),
('106', 'Jersey'), ('107', 'Jordan'), ('108', 'Kazakhstan'), ('109',
'Kenya'), ('110', 'Kiribati'), ('111', 'Kosovo'), ('112', 'Kuwait'),
('113', 'Kyrgyzstan'), ('114', 'Laos'), ('115', 'Latvia'), ('116',
'Lebanon'), ('117', 'Lesotho'), ('118', 'Liberia'), ('119', 'Libya'),
('120', 'Liechtenstein' ), ('121', 'Lithuania'), ('122', 'Luxembourg'),
('123', 'Macao'), ('124', 'Madagascar'), ('125', 'Malawi'), ('126',
'Malaysia '), ('127', 'Maldives'), ('128', 'Mali'), ('129', 'Malta'),
('130', 'Marshall Islands'), ('131', 'Mauritania'), ('132',
'Mauritius'), ('133', 'Mayotte'), ('134', 'Mexico'), ('135',
'Micronesia'), ('136', 'Moldova'), ('137', 'Monaco'), ('138',
'Mongolia '), ('139', 'Montenegro'), ('140', 'Montserrat'), ('141',
'Morocco'), ('142', 'Mozambique'), ('143', 'Myanmar'), ('144',
'Nagorno-Karabakh'), ('145', 'Namibia'), ('146', 'Nauru'), ('147',
'Nepal'), ('148', 'Netherlands'), ('149', 'Netherlands Antilles'),
('150', 'New Caledonia'), ('151', 'New Zealand '), ('152',
'Nicaragua'), ('153', 'Niger'), ('154', 'Nigeria'), ('155', 'Niue'),
('156', 'Norfolk Island'), ('157', 'North Korea'), ('158', 'Northern
Cyprus'), ('159', 'Northern Mariana Islands'), ('160', 'Norway'),
('161', 'Oman'), ('162', 'Pakistan'), ('163', 'Palau'), ('164',
'Palestine'), ('165', 'Panama'), ('166', 'Papua New Guinea'), ('167',
'Paraguay'), ('168', 'Peru'), ('169', 'Philippines'), ('170',
'Pitcairn Islands'), ('171', 'Poland'), ('172', 'Portugal'), ('173',
'Pridnestrovie' ), ('174', 'Puerto Rico'), ('175', 'Qatar'), ('176',
'Republic of Macedonia'), ('177', 'Romania '), ('178', 'Russia'),
('179', 'Rwanda'), ('180', 'Saint Helena'), ('181', 'Saint Kitts and
Nevis'), ('182', 'Saint Lucia '), ('183', 'Saint Pierre and
Miquelon'), ('184', 'Saint Vincent & the Grenadines'), ('185',
'Samoa'), ('186', 'San Marino'), ('187', 'São Tomé and Príncipe'),
('188', 'Saudi Arabia'), ('189', 'Senegal'), ('190', 'Serbia'),
('191', 'Seychelles'), ('192', 'Sierra Leone'), ('193', 'Singapore'),
('194', 'Slovakia'), ('195', 'Slovenia'), ('196', 'Solomon Islands '),
('197', 'Somalia'), ('198', 'Somaliland'), ('199', 'South Africa'),
('200', 'South Korea'), ('201', 'South Ossetia'), ('202', 'Spain'),
('203', 'Sri Lanka'), ('204', 'Sudan'), ('205', 'Suriname'), ('206',
'Svalbard'), ('207', 'Swaziland'), ('208', 'Sweden'), ('209',
'Switzerland'), ('210', 'Syria'), ('211', 'Taiwan'), ('212',
'Tajikistan'), ('213', 'Tanzania'), ('214', 'Thailand'), ('215',
'Timor-Leste'), ('216', 'Togo'), ('217', 'Tokelau'), ('218', 'Tonga'),
('219', 'Trinidad and Tobago'), ('220', 'Tristan da Cunha'), ('221',
'Tunisia'), ('222', 'Turkey'), ('223', 'Turkmenistan '), ('224',
'Turks and Caicos Islands'), ('225', 'Tuvalu '), ('226', 'Uganda'),
('227', 'Ukraine '), ('228', 'United Arab Emirates '), ('229', 'United
Kingdom'), ('230', 'United States'), ('231', 'Uruguay'), ('232',
'Uzbekistan'), ('233', 'Vanuatu'), ('234', 'Vatican City'), ('235',
'Venezuela'), ('236', 'Vietnam'), ('237', 'Virgin Islands, British'),
('238', 'Virgin Islands, United States'), ('239', 'Wallis and
Futuna'), ('240', 'Western Sahara'), ('241', 'Yemen'), ('242',
'Zambia'), ('243', 'Zimbabwe');

Jan 27 '07
15 5272
Sanders Kaufman wrote:
Carl Pearson wrote:
>This does not seem to be accurate. At least as far back as MySQL
version 3.23, double-quotes are most certainly acceptable for
enclosing strings. Section 9.1.1 of the manual details this:

Yeah, it is. I recently lost an argument I was very confident about -
that double-quotes is actually the ANSI standard. I got so used to
using double-quotes, I forgot they were the wrong way to do strings.
Well, as this is a mySQL list, and the manual says strings may be
surrounded by single or double quotes, I'd say they are quite legal.

This is all moot anyway, as I was incorrectly equating table defs
surrounded by quotes to be strings, which they are not.

So far as ANSI vs MySQL, You're talking style here, not syntax. "Wrong
way" has no meaning if the statement as run produces valid output.

BTW, found the real problem in the original post. Darn those ticks!
Jan 29 '07 #11
>At least your statement above is *half* right. I was looking at the
>wrong section, 9.1.1 (which defines what a string can be), not 9.2
(which defines what table, index, column & alias names can be).

But 9.2 does also state:
An identifier may be quoted or unquoted.

The only exception would be using reserved words, but 'id' and
'countries' are not on that list.

Still, saying that surrounding table names with quotes is 'required' is
not true.
There are lots more places than reserved words that require ``
around table names. For example, table names containing spaces.
Or table names that look like numbers. Or table names containing
punctuation.

Jan 29 '07 #12
Carl Pearson <jm************ *****@gmail.com wrote:
....
So, to re-cap:
Backticks only for enclosing table & field names, NOT data!
Single OR double quotes around data are OK - even numbers!

This may not be the *preferred* way, but it's legal syntax.

Now, tiny rant here...

Yes, you are correct that backticks are allowed to identify table names,
and I thank you for getting me to look a little harder to discover that.

But, this is a MySQL list, NOT an ANSI SQL list, and double-quotes -
whether or not you disagree with using them - are valid syntax in MySQL.
Careful!

Beginning with 5.0 MySQL knows of the so-called server SQL mode. If you
have ANSI_QUOTES in effect, MySQL uses ANSI style quoting rules (string
literals using single quotes and identifiers using double quotes).

Same goes for escaping: traditionally MySQL uses the backslash to
escape the quote character in a string literal. i.e. 'L\'Oreal'. Now
you can have SQL mode NO_BACKSLASH_ES CAPES, making the backslash an
ordinary character. To escape the quote character, you have to double
it now: 'L''Oreal'.

So whenever you refer to "correct" quoting in MySQL, make sure to
mention the SQL mode in use.

http://dev.mysql.com/doc/refman/5.0/...-sql-mode.html
XL
--
Axel Schwenke, Support Engineer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Jan 29 '07 #13
Axel Schwenke wrote:
Careful!

Beginning with 5.0 MySQL knows of the so-called server SQL mode. If you
have ANSI_QUOTES in effect, MySQL uses ANSI style quoting rules (string
literals using single quotes and identifiers using double quotes).
Thanks for that info, I'd been thinking there may have been some
difference between the original poster's setup & mine, but never said as
much.

Did all my testing for this little exercise on my home box, like I said
5.0.27-community, with the default of no mode set.

Also, an apology to Mr. Stuckle, was not looking closely enough at the
data in the original post, it was normal single quotes, not backticks.

So, still confusing why backticking the table & field names at the
beginning of the INSERT made it bomb out. Escaping the single quote
within country 54 was needed, sure, but any attempt at backticking
either "countries" , "id", or "country" in

INSERT INTO countries (id,country) VALUES

caused error 1064 (Syntax). This was either via CLI, or phpMyAdmin.

Go figure. The only other variable I can see is that I touch-type in
Dvorak, but ASCII 96 (decimal) still produces the backtick like it's
supposed to.

Perhaps it's a M$ plot! ;)

(Of course, now that I've said that, suddenly the insert is working with
the backticks. So perhaps the whole problem really was only not escaping
the single quote within country 54, but I swear I tried it 6 ways to
Sunday & the backticks weren't working. Very confusing!)
Jan 29 '07 #14
Carl Pearson wrote:
Sanders Kaufman wrote:
Well, as this is a mySQL list, and the manual says strings may be
surrounded by single or double quotes, I'd say they are quite legal.
It also shows how you can setup MySQL to not make that mistake.

The double-quotes are not a way to enclose strings.
They are a way MySQL forgives users who make mistakes.

So far as ANSI vs MySQL, You're talking style here, not syntax. "Wrong
way" has no meaning if the statement as run produces valid output.
Yah - but then some fellow comes along and sets MySQL to enforce
standards and suddenly you find that your Wrong Way doesn't work
anymore.
Jan 29 '07 #15
Sanders Kaufman wrote:
Carl Pearson wrote:
>Sanders Kaufman wrote:
>Well, as this is a mySQL list, and the manual says strings may be
surrounded by single or double quotes, I'd say they are quite legal.

It also shows how you can setup MySQL to not make that mistake.

The double-quotes are not a way to enclose strings.
They are a way MySQL forgives users who make mistakes.
Uhm, the manual says it's OK. So, it's OK. ANSI & MySQL specs are
different, one must respect & adapt to what the respective authors
allow. It is by definition not a "mistake" if you follow the allowed
syntax!

I understand what you're trying to say, that one should not write
anything but strict ANSI SQL code. Alas for your attitude, the authors
of MySQL must have had a different idea.
>
>So far as ANSI vs MySQL, You're talking style here, not syntax.
"Wrong way" has no meaning if the statement as run produces valid output.

Yah - but then some fellow comes along and sets MySQL to enforce
standards and suddenly you find that your Wrong Way doesn't work anymore.
So he turns the standards back off & continues on his merry way.

Again, it matters not one whit that ANSI does not allow the
double-quote, but MySQL does. This is not an ANSI SQL list; it simply
does not matter if double-quotes are used to enclose strings in MySQL,
as the language allows them.

Let's say the new guy inherits some code, decides to change modes, and
it breaks the code. Happens all the time.

At this point, he has three choices:

Come up to speed with what the (to him) new dialect.

Grab his favorite regex-friendly text editor & get to work.

Find a new job.
Again, MySQL says double-quotes are OK for strings. It's irrelevant
that for ANSI, they're not. Yes, it is that simple!

Geez!
Jan 29 '07 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5651
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their first name, last name, email, etc. The data are then sent to a PHP script (reg.php). The data are then inserted into a table (reg) in MS SQL server. I have declared the variables like this: if (!(isset($_POST))) { $FirstName = "" ;
14
4305
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
0
3153
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too much data for field' or the query just runs on and on til I have to restart the postmaster. I have found rules to compare mine to but people limit the resulting insert to one record (the WHERE generally limits the result of the SELECT to one...
16
17026
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
8
6302
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with one-to-one relationship but on this occasion I must keep username/password details within a seperate table. Here's the basic specs and database schema: -------------------------------------------
2
2038
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text; string comlnB = TextBox2.Text; string sqlstatment = "INSERT INTO TABLENAME VALUES(" +"'"+colmnA+"'" + "," + "'" + colmnB + "'" + ")";
7
4358
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the sqldatasource of the formview. If i put this textboxes outside the table everything works well, but as soon as i put them inside the table (in order to organize the layout in the right way) they doesn't work. They works only as eval() and not bind()...
4
4869
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a sql DataAdapter (da) da.SelectCommand.CommandText = "Select * from Servertbl1" da.Fill(ds, "tbl1") so far, so good. If I add a row to the datagridview I use the following sqlDataAdapter code to update the server table - which works OK when...
6
3685
by: sgulciny | last post by:
hi friends; I have problem about sql server insert and update in client side. I am coding windows application with c#.When I run my code in database server computer all is fine.I can see data, insert and update.But when I run same code in client side I can see data but not insert not update what can I do about this problem .I use sql server 2000 database.Client side connections ok. :( thanks for all
8
5030
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause this behavior. I'd simply like to have the tab key insert a tab at the beginning of a line. I believe that there were publlished macros for doing this in earlier VS versions, but I expected this to be 'fixed' in VS2008. Yes, I realize someone...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10422
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10139
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9222
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.