php-signup-login icon indicating copy to clipboard operation
php-signup-login copied to clipboard

Signup is not working properly.

Open LilPhyziX opened this issue 2 years ago • 8 comments

Hello. When i try to register, i am greeted with this message: Field 'id' doesn't have a default value 1364

I dont know what this means but all i know is its preventing the details to go into the database.

Any help would be greatly appreciated.

Thanks in advance!

LilPhyziX avatar Aug 07 '23 19:08 LilPhyziX

It looks like you don't have AUTO_INCREMENT set on your id column in the database - this assigns IDs automatically when you insert a new record.

daveh avatar Aug 08 '23 07:08 daveh

I do have auto increment on though. However i dont see anything in the code that inserts anything into the id

LilPhyziX avatar Aug 08 '23 14:08 LilPhyziX

Then you don't need to include the id in the list of fields in the insert statement, or in the list of values. New records will be assigned a new value automatically.

daveh avatar Aug 08 '23 17:08 daveh

Alright. I fixed the signup, however the login is not working now.

LilPhyziX avatar Aug 09 '23 17:08 LilPhyziX

Here is the code for the signin page:

real_escape_string($_POST["email"])); $result = $mysqli->query($sql); $user = $result->fetch_assoc(); if ($user) { if (password_verify($_POST["password"], $user["password_hash"])) { session_start(); session_regenerate_id(); $_SESSION["user_id"] = $user["id"]; header("Location: index.php"); exit; } } $is_invalid = true; } ?> Sign In

LilPhyziX avatar Aug 09 '23 17:08 LilPhyziX

Uhm. I dont think it was supposed to display the actual elements

LilPhyziX avatar Aug 09 '23 17:08 LilPhyziX

I will just upload the file. # signin.php.txt

LilPhyziX avatar Aug 09 '23 17:08 LilPhyziX

Please can you describe exactly what the problem is? Do you get any error messages?

daveh avatar Aug 10 '23 07:08 daveh