Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>So far the problem is it is saying the users email is not in the database when in fact it is.</p> </blockquote> <p>As far as I can see there is nothing wrong with your query but not putting your $tbl_name value in quotes probably isn't helping. Also, have you doubled checked the name attribute on the email input is definitely email too and that it all matches up correctly?</p> <blockquote> <p>Also, should I update the database to store the random password or will the way I have it work?</p> </blockquote> <p>The way I usually do it is like this, when they request a new password, generate a token along with their user id and email. Send them an email with a link, something like the following:</p> <p><code>example.com/reset/?id=THERE_ID&amp;token=RANDOM_TOKEN</code></p> <p>Then on that page check they match up and if it does, let them enter a new password.</p> <blockquote> <p>I have heard that it is not a good idea to send the original password to the user via email</p> </blockquote> <p>In all honesty, you shouldn't even be storing raw passwords in your db anyway, you want to look up things like <a href="http://php.net/manual/en/function.hash-hmac.php" rel="nofollow"><code>hash_hmac</code></a> and <a href="http://en.wikipedia.org/wiki/Salt_%28cryptography%29" rel="nofollow">password salts</a> - there should be other links somewhere on those types of pages for you to figure it all out with the tutorials/examples.</p> <p>And as a final note, always validate your user input (<a href="http://www.regular-expressions.info/" rel="nofollow">regex for example</a>), since you're using <code>mysql_query</code> you always want to be escaping inputs too with <a href="http://php.net/manual/en/function.mysql-real-escape-string.php" rel="nofollow"><code>mysql_real_escape_string</code></a> - a preferred method for querys is to use <a href="http://php.net/manual/en/pdo.prepared-statements.php" rel="nofollow">prepared statements</a>, these are very good to stop accidents such as <a href="http://psoug.org/blogs/mike/2010/04/11/little-bobby-tables/" rel="nofollow">little bobby tables</a> coming to your site.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload