Jump to content

Recommended Posts

I've had a MySQL server that's been working fine for years now.  Now I can't input lengthy query commands, either by placing it all on one line without using the Enter button until after the semicolon, nor by hitting Enter to break into steps as shown below, nor by importing it as a sql file in phpmyadmin.  I've been trying to get this specific query to run:

CREATE TABLE IF NOT EXISTS 'events' (
'event_id' INT NOT NULL AUTO_INCREMENT,
'event_title' VARCHAR(80) DEFAULT NULL,
'event_desc' TEXT,
'event_start' TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
'event_end' TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',

PRIMARY KEY ('event_id'),
INDEX ('event_start')
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

INSERT INTO 'events'
('event_title', 'event_desc', 'event_start','event_end')
VALUES
(
"New Year's Day", 'Happy New Year!',
'2010-01-01 00:00:00', 2010-01-01 23:59:59'
),
(
'Last Day of January', 'Last day of the month! Yay!',
'2010-01-31 00:00:00', '2010-01-31 23:59:59'
);

 

And it results in this error (this is the phpmyadmin formatted response, but it's the same regardless of which method I use)

 

#1064 - 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 ''events' (

'event_id' INT NOT NULL AUTO_INCREMENT,

'event_title' VARCHAR(80) DEF' at line 1

 

It seems to be truncating at that specific number of characters. Did one of my mysql settings get whacked?  Why can't I do anything but very short queries like drop commands or "show tables?"

Link to comment
https://forums.phpfreaks.com/topic/239710-mysql-truncating-input-commands/
Share on other sites

Hi,

 

The issue is the quotes you are using for the field names, either dont use any or use the ` one (on my keyboard, very top left, left of number one), I dont know the name of this quote specifically but it should be used for table or field names only, not values.

 

Try this....

 

CREATE TABLE IF NOT EXISTS `events` (
`event_id` INT NOT NULL AUTO_INCREMENT,
`event_title` VARCHAR(80) DEFAULT NULL,
`event_desc` TEXT,
`event_start` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`event_end` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',

PRIMARY KEY (`event_id`),
INDEX (`event_start`)
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

 

Regards

 

DK

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.