Jump to content

Recommended Posts

Posted

I have looked around for a solution for about the last 2 hours but I haven't had any luck. This is the error I am getting:

 

 

Warning: mysqli::prepare() [mysqli.prepare]: (42S22/1054): Unknown column 'email' in 'field list' in /home/content/41/6344941/html/php/login/register.php on line 88

 

Fatal error: Call to a member function bind_param() on a non-object in /home/content/41/6344941/html/php/login/register.php on line 89

 

Error 2 definitely is tied to the first error so that isn't a big deal. I am actually working on the Login Script training videos right now. I am on part 11 (retrieve lost password). Anyway at the end of the video when I go to load my script this is my error. I also loaded in the downloadable files from Ben and I get the same error so it has to be something other than the code I think. Any help would be great! Thanks =).

Posted

Two things:

 

- can you post the code you are working with? (either the whole file, or maybe 10 lines above and below line 88 where you are having the issue?)

- do you have an "email" column in your database? (In my database, I have columns for "id", "username", "type", "email", "password", and "pw_reset")

Posted

I definitely have the email column in the members table - it almost seems like it isn't finding it for some reason - not sure anyway here is the file. I appreciate your help man.

Posted

it's the weirdest thing because if I change (for testing purposes) the sql statements from email to say id or password then it works just fine (as in no errors). It is almost like the program is not seeing the newly entered db column 'email' for some reason.

Posted

So the line that is having the issue is this line?

 

$check = $mysqli->prepare("SELECT email FROM members WHERE email = ?");

(line 93)

 

You said it was an issue with line 88, but I'm not seeing anything that should cause an issue there.

 

I'm not sure why you are including the database include twice though (though I don't think it has anything to do with your error). On line 91, you have "include('includes/database.php');" yet you have already included that file on line 11. There shouldn't be any need to include the file twice.

 

I've tested this code, and I'm not having any issues. My guess is it has to be something to do with the database. Have you double checked the spelling of the column in the database? If you used "Email" or "e-mail" that may cause issues when you are trying to target a column called "email".

Posted

Yea I added that extra include in there for testing and a few extra lines- I didn't mean to send that to you that's why the line error was off. I just went in and completely recreated the members table and it works fine. Seems really weird lol. Sorry to waste your time I should have tried something like that first it was just a really odd issue I have never heard of recreating a table to fix something like that.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...