Jump to content

Variable Posts on submit, but kee getting a warning.


aeboi80

Recommended Posts

I have a basic form.  User inputs their email address and hits submit.

 

<form method="post" action="resend3.php" name="getemail">
<label>Email Address</label><input name="emailaddress" size="50" maxlength="100" /><br />
<input type="submit" name="submit" value="Resend »" />
<input type="hidden" name="getemail" />
</form>

 

When the I enter an email address which IS in the database I keep getting the error:

 

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/buzzwah/public_html/resend3.php on line 18

 

Here is the contents of the file resend3.php which the form is submitting to:

 

$link=mysql_connect($DBHOST, $DBUSER, $DBPASSWORD);
mysql_select_db($DBNAME, $link);

$emailaddress = $_POST["emailaddress"];
echo "this is email".$emailaddress;

$query = "SELECT USERID FROM members WHERE email =$emailaddress";
$result = mysql_query($query);

while ($name_row = mysql_fetch_row($result)) {
echo $name_row[0];
}

 

As you can see I am setting the $_Post variable of email address = $emailaddress  and that actually prints out to the screen.  I am not sure what is causing the mysql error.

 

Thanks :)

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.