View Full Version: auto increment

MPAM Rebooted Forums > Software support (freewares, PHP...) > auto increment


Title: auto increment


257335 - January 4, 2007 06:19 AM (GMT)
in the login script tha yall have it makes a collum called id that auto increment can you tell me how to do that. im trying to add it to a table that already had infomation in it and i keep get #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

patheticcockroach - January 4, 2007 02:50 PM (GMT)
It's hard to tell without any data... could you export your table structure so I can edit it to show you ? (open a table, click on "export" and make sure structure is checked but not data)

257335 - January 4, 2007 06:38 PM (GMT)
i think this is wha u wanted
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 04, 2007 at 12:36 PM
-- Server version: 5.0.27
-- PHP Version: 5.2.0
--
-- Database: `realestate`
--

-- --------------------------------------------------------

--
-- Table structure for table `estate`
--

CREATE TABLE `estate` (
`address` varchar(255) default NULL,
`zipcode` int(6) default NULL,
`price` text,
`baths` decimal(3,1) default NULL,
`bedrooms` int(255) default NULL,
`state` varchar(15) default NULL,
`city` varchar(20) default NULL,
`squarefeet` text,
`county` varchar(30) default NULL,
`subdivision` varchar(30) default NULL,
`yearbuilt` varchar(255) default NULL,
`description` text,
`buyorlease` varchar(5) default NULL,
`typeofprop` varchar(30) default NULL,
`imagename` varchar(255) default NULL,
`acreage` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

patheticcockroach - January 4, 2007 07:44 PM (GMT)
run the following query in phpmyadmin :
CODE
ALTER TABLE `estate` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;

this will add an id that auto-increments.




Hosted for free by InvisionFree