mysql - PDO query fails to execute when AUTO_INCREMENT included in creation script, but query seems to be valid -
i'm trying test scripts set phpunit using in-memory databases, i'm having trouble creating databases correctly. when first ran queries running fine, i'd forgotten add auto_increment id field. once added that, pdo drop out fatal error time script ran. i've tried running same query through phpmyadmin see if works (it goes through without complaints) , used perform action wanted , copied sql ran without luck, i'm kind of @ loss what's going on. if can give me hand it'd big help. query can found below
create table if not exists `checks` ( `id` int(60) not null auto_increment, `check_type` varchar(255), `purchase_id` varchar(255), `price` varchar(255), `time` varchar(255), `user_id` varchar(255), `email` varchar(255), `site_id` varchar(255), primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=1 ;
varchar's used except id because running through automated script , data type can vary. it's mysql database if makes difference. can give
edit: adding full error message requested:
sqlstate[hy000]: general error: 1 near "auto_increment": syntax error
i getting same thing when switched using pdo. remove not null on id field. don't know why... don't see documentation.
create table if not exists `checks` ( `id` int(60) auto_increment, `check_type` varchar(255), `purchase_id` varchar(255), `price` varchar(255), `time` varchar(255), `user_id` varchar(255), `email` varchar(255), `site_id` varchar(255), primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=1 ;
Comments
Post a Comment