Jump to content

erro na ligação à db


Recommended Posts

Boas, se alguém me pudesse ajudar era 5 estrelas, desde já obrigado.


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/galactica.awardspace.co.uk/forgot.php on line 7
Account with given email does not exist


include 'dbc.php';
if ($_POST['Submit']=='Send')
$host = $_SERVER['HTTP_HOST'];
$rs_search = mysql_query("select username_email from jogo_users where username_email='$_POST[email]'");
$username_count = mysql_num_rows($rs_search); // <<<<<<------------ linha 7 AQUI !!!!

if ($username_count != 0)
$newpassword = rand(1000,9999);
$host = $_SERVER['HTTP_HOST'];
$newmd5password = md5($newpassword);
mysql_query("UPDATE jogo_users set username_password='$newmd5password' where username_email='$_POST[email]'");
$message = 
"You have requested new login details from $host. Here are the login details...\n\n
User Name: $_POST[email] \n
Password: $newpassword \n
*** LOGIN ***** \n
To Login: http://$host/index.php \n\n
Thank you. This is an automated response. PLEASE DO NOT REPLY.

mail($_POST['email'], "New Login Details", $message,
    "From: \"Auto-Response\" <robot@$host>\r\n" .
     "X-Mailer: PHP/" . phpversion());

die("Thank you. New Login details has been sent to your email address");
} else die("Account with given email does not exist");

<p> </p>
<h3>Forgot Password</h3>
<p>Please enter your email address and the new password will be sent.</p>
<table width="50%" border="0" cellpadding="1" cellspacing="0">
      <form name="form1" method="post" action="">
          <input name="email" type="text" id="email">
          <input type="submit" name="Submit" value="Send">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php ?>

APARTE: Usa o Geshi, torna o post mais legível. 🙂

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.