Reputation: 35
$invited = "CREATE TABLE invited (id NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), name VARCHAR(255), email VARCHAR(255), permissions VARCHAR(255))";
mysqli_query($dbc, $invited) or die ('Error creating invited');
What is wrong with this code? Keeps giving me "Error creating invited"
Upvotes: 0
Views: 48
Reputation: 2564
Use this.
CREATE TABLE `invited` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Upvotes: 1
Reputation: 204746
You forgot the ID
data type
CREATE TABLE invited
(
id INT NOT NULL AUTO_INCREMENT, ...
^--------------------------------------here
Upvotes: 4