Fakcon Posted November 27, 2009 at 02:33 AM Report Share #297725 Posted November 27, 2009 at 02:33 AM Boas, se alguém me pudesse ajudar era 5 estrelas, desde já obrigado. erro: 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 Código: <?php 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"> <tr> <td> <form name="form1" method="post" action=""> <p><br> <strong>Email:</strong> <input name="email" type="text" id="email"> <input type="submit" name="Submit" value="Send"> </p> </form></td> </tr> </table> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <?php ?> </body> </html> APARTE: Usa o Geshi, torna o post mais legível. 🙂 Link to comment Share on other sites More sharing options...
cyclop Posted November 27, 2009 at 11:27 AM Report Share #297742 Posted November 27, 2009 at 11:27 AM Poderá estar a acontecer por teres um erro na query ( Não existir a tabela, o campo, ou mesmo um simples erro de sintaxe ) com isso, o objecto não é retornado e o num_rows não irá funcionar "Quando eu for grande quero ser como o Celso" Link to comment Share on other sites More sharing options...
Fakcon Posted November 27, 2009 at 02:19 PM Author Report Share #297765 Posted November 27, 2009 at 02:19 PM tnks, vou ver se apanho o rabo ao gato Link to comment Share on other sites More sharing options...
yoda Posted November 27, 2009 at 02:54 PM Report Share #297775 Posted November 27, 2009 at 02:54 PM Experimenta tirar o $rs_search de dentro da tal função. before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now