Criação de tabela no MySQL - erro

MySQL

02/05/2015

Tentando criar uma tabela no MySQL aparece o seguinte erro



#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 'vachar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0
NOT NULL,
' at line 6



SQL utilizado


CREATE TABLE IF NOT EXISTS `ci_sessions` (
    session_id varchar(40) DEFAULT '0' NOT 
NULL,
    ip_address varchar(45) DEFAULT '0' NOT
NULL,
    user_agent vachar(120) NOT NULL,
    last_activity int(10) unsigned DEFAULT 0
NOT NULL,
    user_data text NOT NULL,
    PRIMARY KEY (sessio_id),
    KEY `last_activity_idx` (`last_activity`)
);



O que está errado?
Marcio Araujo

Marcio Araujo

Curtidas 0

Respostas

Marcio Araujo

Marcio Araujo

02/05/2015

UP! UP!!!
GOSTEI 0
Fernando C

Fernando C

02/05/2015

não existe "vachar"
GOSTEI 0
Marcio Araujo

Marcio Araujo

02/05/2015

Desculpa hein, que vacilo, vou rever isso assim que puder!
GOSTEI 0
Marcio Araujo

Marcio Araujo

02/05/2015

Consegui, tinha dois erros, o que você informou e o outro estava escrito sessio_id

a forma correta


CREATE TABLE IF NOT EXISTS `ci_sessions` (
    session_id varchar(40) DEFAULT '0' NOT 
NULL,
    ip_address varchar(45) DEFAULT '0' NOT
NULL,
    user_agent varchar(120) NOT NULL,
    last_activity int(10) unsigned DEFAULT 0
NOT NULL,
    user_data text NOT NULL,
    PRIMARY KEY (session_id),
    KEY `last_activity_idx` (`last_activity`)
);

GOSTEI 0
Marcio Araujo

Marcio Araujo

02/05/2015

Obrigado Fernando!
GOSTEI 0
Fernando C

Fernando C

02/05/2015

ops.. o 2º nem tinha me tocado.. disponha e sucesso..
GOSTEI 0
Marcio Araujo

Marcio Araujo

02/05/2015

ops.. o 2º nem tinha me tocado.. disponha e sucesso..



kkkkkk
GOSTEI 0
POSTAR