Forum Moderators: open

Message Too Old, No Replies

No index Defined

Can't make field id unique

         

kkonline

4:29 am on Aug 27, 2007 (gmt 0)

10+ Year Member



I am working on editing of articles.
Whatever the user enters to edit a particular article then that will be saved wow table(actual table), the already existing data goes to wow_history

something like

$add_history = "INSERT INTO wow_history SELECT * FROM wow WHERE id = $id"; ";
mysql_query($add_history);

Before updating the table with new edits

so i have wow and wow_history table identical except that in wow_history the id is not auto incremented (if auto incremented then ONLY THE ORIGINAL data copied stored in wow_history, but rest of the successive edits are lost)

But now it says in wow_history that index not defined! So what should i do? Should i leave the wow_history without an index?

The table i use is

CREATE TABLE `wow_history` (
`id` int(11) unsigned default NULL,
`contributed_by` text,
`title` tinytext,
`content` text,
`date` bigint(20) NOT NULL default '0',
`mood` int(2) NOT NULL default '0',
`tags` text,
`trusted` tinyint(1) NOT NULL default '0',
`modified` tinyint(1) NOT NULL default '0',
`ip` varchar(80) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I tried making uid (another field as autoincremented index but then data of wow is not copied to wow_history)

aspdaddy

1:04 pm on Aug 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just add wow_id to the wow_history table and then wow_history_id as the auto-increment