Hello I have a promlem with the database I use in Roundcube. I placed all my contacts in the database by using a MySQL-Query in PHPMyAdmin. I can make changes to the contacts within the Roundcube-adressbook, but i cant add a new contact to it -> red Saving Error message on top of roundcube.
I tried to switch the "contact_id" of the contacts to auto-increment, but this is not allowed. MySQL-Error: #1062 - Duplicate entry '1' for key 1
My table look like this:
-- `contacts`
CREATE TABLE IF NOT EXISTS `contacts` (
`contact_id` int(10) unsigned NOT NULL,
`changed` datetime NOT NULL default '1000-01-01 00:00:00',
`del` tinyint(1) NOT NULL default '0',
`name` varchar(128) NOT NULL default '',
`email` varchar(128) NOT NULL,
`firstname` varchar(128) NOT NULL default '',
`surname` varchar(128) NOT NULL default '',
`vcard` text,
`user_id` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`contact_id`),
KEY `user_contacts_index` (`user_id`,`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Constraints der Tabelle `contacts`
--
ALTER TABLE `contacts`
ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
Is there a way to add to the prefilled database new entrys. :confused:
Is auto-increment the solution, I could not get it working? How can I give the database the info to keep adding new entrys beginning with contact_id = 122, because the there are already entrys from 1-121 in the database.
Update: Now I found out how to add manually an entry: by adding a entry with MySQL with writing the contact_id = 122 manually. This shows me that the database does not know which id is next (like auto increment). How can I solve this? How is the adressbook managed to add with the next bigger number?
save.inc of the adressbook looks like this
// insert record and send response
if (!$plugin['abort'] && ($insert_id = $CONTACTS->insert($a_record)))
{
// add contact row or jump to the page where it should appear
$CONTACTS->reset();
$result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
rcmail_js_contacts_list($result, 'parent.');
$OUTPUT->command('parent.contact_list.select', $insert_id);
My MySQL-database does not know the number of entrys --> I cant add new entrys. What can Ido with this parent row?