Check if email already exists in database

后端 未结 4 1568
萌比男神i
萌比男神i 2021-01-29 04:28

I have a quiz form that is connected to my database, however I need to prevent duplicate email entries being inserted. I have tried the following:

//Check for d         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-29 04:49

    Two problems:

    1. You're never calling your checkEmail() function so it's never running. You should either remove that code from the function or just call the function where it needs to run.
    2. In that function you're checking that no email exists that literally equals "$email". PHP will only parse variables in double quotes - change that line to use where('email','=',"$email") instead.

提交回复
热议问题