Forums

Still Struggling with Duplicate Entry for key Primary

hangbill 27 Jun, 2019
Saving a new Joomla user to two tables, users and a related table misc_user_addfields

The pk for users = id (int, auto increment)
The fk for misc_user_addfields = userid (int)

So what I’m trying to do is make userid = id so that when the form saves the two records are related.
In setup have a save user action and inside its success event have a save data action, see images

Don’t understand why there’s a duplicate key - the pk and fk are in different tables

And just to confirm what the two left override columns represent
Left column = fieldname
Middle column = data source

Seems then the last entry in overrides should work, ie find the id in joomla _user15 and insert into userid.
If this works then userid = id and the two tables are related.
No?

https://snag.gy/DxZoC1.jpg
https://snag.gy/XWqY5D.jpg
healyhatman 27 Jun, 2019
It SHOULD be working I can't see why it wouldn't, send me access details and I'll look all I can think is that you made a mistake when you messed around with the tables
hangbill 27 Jun, 2019
Will do, thanks.
Sent you an email

users table => https://snag.gy/A3RhBs.jpg
related table => https://snag.gy/etIr8u.jpg
hangbill 12 Jul, 2019
Still haven't solved.
Using save data action works but password not hashed. Is there a way to hash the password before it is saved?
healyhatman 12 Jul, 2019
Using PHP or the save user action.
healyhatman 12 Jul, 2019
I'll have another look in a bit
healyhatman 13 Jul, 2019
Hey Max I can't figure this one out.

The error happens in preview on their site but I restored a users dump on my local and can't replicate the issue.
This topic is locked and no more replies can be posted.