Jump to content

[SOLVED] Undefined variable: error


verN

Recommended Posts

i get the following error- Notice: Undefined variable: emails in d:\..\ on line 49

 

$ret_email= "SELECT emailAddress FROM mailinglists WHERE seminarID= '$id'";
	$email_result= mysql_query($ret_email, $dbc) or die (mysql_error());		
	// retrieves the date from a particular seminar number.
	while ($row=mysql_fetch_array($email_result)) {
			   $emails = $row['emailAddress'];
	}

 

// where the mailinglist is created then an email can be send

line: 49

if($emails !="") { 
                          //can view the template
                          { else {
                            echo '<h1>need to create mailing list</h1>';
                          } 

                       

 

what i am trying to do is to be able to check if the user has created a mailing list if they haven't then a message appears saying that the user need to create one. This code works where there are email addresses created however where there are no email address created then the message does appear that the user needs to create a mailing list however it also comes with the following error

Notice: Undefined variable: emails in d:\..\ on line 49

 

i know that the email addresses in the emails variable are empty but how do i resolve this error

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/47045-solved-undefined-variable-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.