Jump to content

php code to make a table into the database


itsmeadrean

Recommended Posts

<?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

 

 

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';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.