Jump to content

Problems after revising registration files [SOLVED]


AGuyFawkesMask

Recommended Posts

Hi all,

Happy New Year. I'm experiencing a few issues with my registration page after I edited it for formatting, while at the same time adding a few additional fields. I understand that Nabeel gives admins the option to add custom fields via the Admin Panel, but I noticed that when that happens, I'm faced with a huge problem when it comes to formatting. As a result, I formatted the registration_mainform.tpl as I needed it to be formatted and took out the code that included the custom fields. I then manually added those custom fields and created columns in my phpvms_pilots database on my server.

After doing so, upon registering a test pilot, I'm encountering this error:

Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)

Does anyone know what I can do to solve this error? I can provide additional code if needed. (Sorry for the trouble. I've been getting such a headache from this since Wednesday night!)

Link to comment
Share on other sites

After enabling debug mode via local.config.php (as per Nabeel's signature), it came back with the following code:

=====
Time: 01.14.12 14:59:12
=====
Time: 01.14.12 14:59:12
Backtrace: DB::write_debug > DB::query > RegistrationData::AddUser > Registration->ProcessRegistration > Registration->index > call_user_func_array > MainController::RunAllActions
Query: INSERT INTO phpvms_pilots (firstname, lastname, month, day, year, gender, location, hub, email, code, vatsimid, publicity, password, salt, confirmed, joindate, lastip) VALUES ('Test', 'Pilot', '', '', '', '', 'US', 'KLAS', 'test@pilot.com', '', '', '', '48579fbcfbaa56b1464ed25f66c13b53', 'ad0832637b523dfae0a62ae4d1303f11', 0, NOW(), '24.185.108.47')
Error: (1452) - Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)
=====


=====

I'm starting to get the feeling that this error might be very easy to fix. As easy as editing a file I seemed to have missed. Can anyone tell me what the required registration files are to edit when adding custom fields manually? (Not via the admin panel.) So far I've edited registration_mainform.tpl, Registration.php, and RegistrationData.class.php

Link to comment
Share on other sites

After enabling debug mode via local.config.php (as per Nabeel's signature), it came back with the following code:

=====
Time: 01.14.12 14:59:12
=====
Time: 01.14.12 14:59:12
Backtrace: DB::write_debug > DB::query > RegistrationData::AddUser > Registration->ProcessRegistration > Registration->index > call_user_func_array > MainController::RunAllActions
Query: INSERT INTO phpvms_pilots (firstname, lastname, month, day, year, gender, location, hub, email, code, vatsimid, publicity, password, salt, confirmed, joindate, lastip) VALUES ('Test', 'Pilot', '', '', '', '', 'US', 'KLAS', 'test@pilot.com', '', '', '', '48579fbcfbaa56b1464ed25f66c13b53', 'ad0832637b523dfae0a62ae4d1303f11', 0, NOW(), '24.185.108.47')
Error: (1452) - Cannot add or update a child row: a foreign key constraint fails (`flybl110_bluwave/phpvms_pilots`, CONSTRAINT `phpvms_pilots_ibfk_1` FOREIGN KEY (`code`) REFERENCES `phpvms_airlines` (`code`) ON UPDATE CASCADE)
=====


=====

I'm starting to get the feeling that this error might be very easy to fix. As easy as editing a file I seemed to have missed. Can anyone tell me what the required registration files are to edit when adding custom fields manually? (Not via the admin panel.) So far I've edited registration_mainform.tpl, Registration.php, and RegistrationData.class.php

Good news! After vigorously searching through this forum for solutions to my problem, I was able to solve it by changing the formating in the registration_customfields.tpl file :D Everything's working wonderfully! The only thing that I need to now is add a "Confirm email address" field.

Has anyone implemented this at any point in their registration form? I'm interesting in learning the basics of how those people carried out that function on this form.

Thanks in advance!

Link to comment
Share on other sites

  • Administrators

Yes, the code that's generated for the custom fields needs to be "exact", it relies on the proper naming of the fields. Ideally, for formatting issues, fix them via CSS, but that's not always possible.

That error is a database error saying the fields didn't match... your code field is missing? It seems like you added a bunch of fields to the pilots table - those should be custom fields (because if you hardcode changes, you'll have troubles updating later on)

Link to comment
Share on other sites

Yes, the code that's generated for the custom fields needs to be "exact", it relies on the proper naming of the fields. Ideally, for formatting issues, fix them via CSS, but that's not always possible.

That error is a database error saying the fields didn't match... your code field is missing? It seems like you added a bunch of fields to the pilots table - those should be custom fields (because if you hardcode changes, you'll have troubles updating later on)

Thanks for the reply, Nabeel! I decided to make use of your methods that you already have in place (via registration_customfields.tpl) for that exact reason. It ended up that I was missing the code field (which I ended up hiding).

Link to comment
Share on other sites

  • Administrators

Thanks for the reply, Nabeel! I decided to make use of your methods that you already have in place (via registration_customfields.tpl) for that exact reason. It ended up that I was missing the code field (which I ended up hiding).

You can change the code field as a hidden field, that works too, if you don't want a code option

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...