1,105,636 Community Members

Undefined Index: email

Member Avatar
s1Lolz0rz
Newbie Poster
3 posts since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I know there is a lot of threads already on this website, but I cant find any that remotely looks like it'd be help to me.

I am getting frustrated over this bit of code error. Any help would be appreciated.

php line 64

$emails = $_REQUEST['email'];


$data = mysql_query("SELECT current_image, email FROM employees where email='$emails'") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data )) { //Outputs the image and other data

Notice: Undefined index: email in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_u020672/public_html/assignment/user/members.php on line 64


I am asking it to take email and current image from my database, trying to return an image that relates to the email of a user.


Thanks, S

Member Avatar
diafol
Where are my eyes?
12,991 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,849 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

It means that a form field or querystring parameter called email doesn't exist. You should avoid using $_REQUEST - use $_POST or $_GET.

Where is $_REQUEST coming from? A form, a querystring? It appears to be none of these in your case.

It often pays to use an if statement to check the existence of a $_POST array.

Member Avatar
s1Lolz0rz
Newbie Poster
3 posts since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for the reply.

Basically i want the return to be email='$emails'" and i declared the variable ($email)

email is in the mysql database
i am going to ask it to return the image that relates to the email address.


there is no form, it's for a user profile so the user's image will be displayed for the user's email address.

Member Avatar
diafol
Where are my eyes?
12,991 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,849 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

THe whole point is

$emails = $_REQUEST['email'];

The $_REQUEST doesn't exist.

Member Avatar
s1Lolz0rz
Newbie Poster
3 posts since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

how do I call the $emails variable then from the field known as 'email' in my database

Member Avatar
diafol
Where are my eyes?
12,991 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,849 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

Well, it depends what you're trying to do. Usually somebody logs in and has their id stored in a session variable. You then use that stored session variable to get the data (email etc) from the DB.

It's not clear what you're trying to achieve here. The $emails has to come from somewhere. AFAIK, you aren't giving it a value anywhere.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: