Fakcon Posted November 27, 2009 Share Posted November 27, 2009 Hello, please help this noob, and visit my project ( test server ) http://www.galactica.awardspace.co.uk error: 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 Code: <?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'"); $username_count = mysql_num_rows($rs_search); // <<<<<<------------ line 7 !!!! 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'"); $message = "You have requested new login details from $host. Here are the login details...\n\n User Name: $_POST \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> Quote Link to comment https://forums.phpfreaks.com/topic/183081-sql-conection-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 27, 2009 Share Posted November 27, 2009 Your mysql_query() failed to execute. Echo mysql_error(); on the line right after the mysql_query statement to find out why. Quote Link to comment https://forums.phpfreaks.com/topic/183081-sql-conection-error/#findComment-966249 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.