Receiving error "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Email' cannot be null"

Hi,

https://www.youtube.com/watch?v=1NLr9eHowaI section is at 19.51

I am trying to follow the above webinar but I seemed to have hit a snag when adding in the security login step which is meant to automatically log the user in and redirect them to index.php.

While the new record is added to my database I receive the below error message. I am not sure how the email can be null as it's added it to the database so it must not have been null, I am really confused.

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Email' cannot be null

If I disable the "security login" step the the new user account is created and the record added to the database and the page redirects to index.php as expected, it's just they are not autologged in. So it does seem to be something to do with the "security login" step but the fields names all match to the database so I am not sure what is wrong.

Has anyone had this sort of error before that could assist as it's driving me mad! :smiley:

Thanks

Just a few guesses.

Which version of PHP are you on? If not on 7.3, try it.

Do you have validation turned on? Although I doubt that this not the problem, it may be worth a try to turn it off.

Please come back here if the problem persists.

Hi,

I was on 7.1 but I've changed it to 7.3 and no difference. Turned off server and client side validation but still get the same issue.

Not sure if it's any help but the full debug information I get is below. Any ideas what else I could try?

code "23000"
file "/home/casog1/public_html/dmxConnectLib/lib/db/Connection.php"
line 108
message "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Email' cannot be null"
trace "#0 /home/casog1/public_html/dmxConnectLib/lib/db/Connection.php(108): PDOStatement->execute()\n#1 /home/casog1/public_html/dmxConnectLib/modules/dbupdater.php(38): lib\db\Connection->execute('INSERT INTO `Us...', Array, false, 'Users')\n#2 /home/casog1/public_html/dmxConnectLib/lib/App.php(173): modules\dbupdater->insert(Object(stdClass), 'insert1')\n#3 /home/casog1/public_html/dmxConnectLib/lib/App.php(137): lib\App->execSteps(Object(stdClass))\n#4 /home/casog1/public_html/dmxConnectLib/lib/App.php(107): lib\App->execSteps(Array)\n#5 /home/casog1/public_html/dmxConnectLib/lib/App.php(72): lib\App->exec(Object(stdClass))\n#6 /home/casog1/public_html/dmxConnect/api/Scruddy/signup.php(8): lib\App->define(Object(stdClass))\n#7 {main}"

thanks

OK so I think I managed to solve this by allowing the columns to accept null values. As to why this works I have no idea as no null values should ever be inserted…but it works :confused:

1 Like