Forgot Password Lookup Problems 
Author Message
 Forgot Password Lookup Problems

Hello,

I have the following code (simple, I know) to look in my database for
a password that a user has lost based on their email. A user can put
in a correct email address but it returns that the address is not
found in the system. When I login via Telnet I can send the same query
and get positive results but in PHP it doesn't get it.

$query = "SELECT `userpassword` FROM `$user_tablename` WHERE useremail
= '$useremail'";
$results = mysql_query($query);

if(!$results) {
echo "Could Not Locate \"$useremail\" In Our System, Sorry.";

Quote:
} else {

echo "Record Found!! Mailing \"$useremail\" With Username and
Password";

Quote:
}

Thanks For The Help!

Brian
---------------------------
www.cool-palace.com



Tue, 21 Jun 2005 09:03:47 GMT  
 Forgot Password Lookup Problems

Quote:
> Hello,

> I have the following code (simple, I know) to look in my database for
> a password that a user has lost based on their email. A user can put
> in a correct email address but it returns that the address is not
> found in the system. When I login via Telnet I can send the same query
> and get positive results but in PHP it doesn't get it.

> $query = "SELECT `userpassword` FROM `$user_tablename` WHERE useremail
> = '$useremail'";
> $results = mysql_query($query);

> if(!$results) {
> echo "Could Not Locate \"$useremail\" In Our System, Sorry.";
> } else {
> echo "Record Found!! Mailing \"$useremail\" With Username and
> Password";
> }

> Thanks For The Help!

> Brian
> ---------------------------
> www.cool-palace.com

Have you tried placing an echo $query statement after ther $query= statement
to see if it's being translated correctly?  Something like:

 $query = "SELECT `userpassword` FROM `$user_tablename` WHERE useremail =
'$useremail'";
echo $query;
die();

--
Gaylen
PHP KISGB v4.2.0 Guest Book http://www.gaylenandmargie.com/phpwebsite/
PHP KISSQ v3.0.0 Stock Quote http://www.gaylenandmargie.com/phpwebsite



Tue, 21 Jun 2005 09:13:29 GMT  
 Forgot Password Lookup Problems

Quote:
> Hello,

> I have the following code (simple, I know) to look in my database for
> a password that a user has lost based on their email. A user can put
> in a correct email address but it returns that the address is not
> found in the system. When I login via Telnet I can send the same query
> and get positive results but in PHP it doesn't get it.

> $query = "SELECT `userpassword` FROM `$user_tablename` WHERE useremail
> = '$useremail'";
> $results = mysql_query($query);

Sounds like a yet another register_globals problem.

Before running the query, try

echo $query;

If the variables are not what you expect, try to access them as
{$_REQUEST['varname']}

Leonid



Tue, 21 Jun 2005 09:50:08 GMT  
 Forgot Password Lookup Problems

Quote:
>if(!$results) {
>echo "Could Not Locate \"$useremail\" In Our System, Sorry.";
>} else {
>echo "Record Found!! Mailing \"$useremail\" With Username and
>Password";
>}

The test should be (assuming MySQL):

        if (!mysql_num_rows($result)) {...}

From php.net:

... mysql_query() returns TRUE on success and FALSE on error. A
non-FALSE return value means that the query was legal and could be
executed by the server. It does not indicate anything about the number
of rows affected or returned. It is perfectly possible for a query to
succeed but affect no rows or return no rows.

-Ray



Tue, 21 Jun 2005 10:10:54 GMT  
 Forgot Password Lookup Problems

Quote:

> SELECT `userpassword` FROM `$user_tablename`

Why the funny quotes?

Palahala



Tue, 21 Jun 2005 15:26:19 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. RAA and forgotten project passwords?

2. Something forgotten to say about TRACE problem...

3. Pack forget problem...

4. Pack forget problem...

5. tcllib 0.3 install problem , mkIndex.tcl forget close $index

6. Problems with pack forget ... and focus settign afterwards

7. pack forget problem (bug?)

8. best way to refactor dictionary lookup problem

9. Comments sought on table lookup problem

10. table lookup problem

11. awk lookup problem using getline

12. Getline problems with Lookup file

 

 
Powered by phpBB® Forum Software