Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/183081-sql-conection-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.