I got a syntax error flag in my "users" database table, but can't figure the issue out. Please, I need your help.

The following is the error message:

Error
SQL query:

--------------------------------------------------------- --
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS  `users` (

 `user_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 `username` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL ,
 `firstname` VARCHAR( 32 ) COLLATE utf8_unicode_ci NOT NULL ,
 `lastname` VARCHAR( 32 ) COLLATE utf8_unicode_ci NOT NULL ,
 `email` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL ,
 `phone` VARCHAR( 30 ) COLLATE utf8_unicode_ci NOT NULL ,
 `birthday` DATE NOT NULL ,
 `hash` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL ,
 `usersex` VARCHAR( 10 ) COLLATE utf8_unicode_ci NOT NULL ,
 `userimage` VARCHAR( 64 ) COLLATE utf8_unicode_ci NOT NULL ,
PRIMARY KEY (  `user_id` ) ,
UNIQUE KEY  `username` (  `username` ,  `email` ,  `userimage` ,  `phone` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT =4;

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-----------------------------------------------------------

--
-- Table structu' at line 1

And this is my "users" table:

CREATE TABLE IF NOT EXISTS `users` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `firstname` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `lastname` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `phone` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `birthday` date NOT NULL,
  `hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `usersex` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `userimage` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `username` (`username`,`email`,`userimage`,`phone`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

To find this on my own I reduce the lines by half and see if the error is still there. If still there, I halve again until no errors. This finds the bad line in about 4 or less steps then I can focus on that line.

@rproffitt,
Thanks for your input.

I was able to resolve the issue by deleting some data inserted into the DB tables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.