itsmeadrean Posted January 23, 2014 Share Posted January 23, 2014 <?php include("../../connect.php");$burger=$row['event_name']; $query=mysql_query("CREATE TABLE $burger (id int(10) AUTO_INCREMENT,event_id char(50), name char(100))")or die (mysql_error()); ?> error : Incorrect table definition; there can be only one auto column and it must be defined as a key Link to comment https://forums.phpfreaks.com/topic/285602-php-code-to-make-a-table-into-the-database/ Share on other sites More sharing options...
itsmeadrean Posted January 23, 2014 Author Share Posted January 23, 2014 anyone?? Link to comment https://forums.phpfreaks.com/topic/285602-php-code-to-make-a-table-into-the-database/#findComment-1466241 Share on other sites More sharing options...
Mace Posted January 23, 2014 Share Posted January 23, 2014 It says you have to set a key is you want to use auto increment. In this case you want to make it a primary key. CREATE TABLE `$burger` ( `id` INT NOT NULL AUTO_INCREMENT, `event_id` CHAR(50) NOT NULL DEFAULT '0', `name` CHAR(100) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) COLLATE='utf8_unicode_ci'; Link to comment https://forums.phpfreaks.com/topic/285602-php-code-to-make-a-table-into-the-database/#findComment-1466259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.