Jump to content

Find info


user4fun

Recommended Posts

$get_user = mysql_query("SELECT * FROM associnfo WHERE user_email = '".$_POST['em']."'");$q = mysql_fetch_object($get_user);if(!$q) die("FAILED. The email address does not exsist.");  echo "information send to the submitted email";$to = "$em";$subject = "Your Pawword";$message = "<html>Your password is : <? echo '".$q['user_password']."' ?><br>more html code

i know that password should be scambled and stuff, but just for nowin the emailed message the results isyour password is : and then it is empty???why is that?

Link to comment
Share on other sites

It's not empty, youre adding a tag (<? ... ?>) that is treated as HTML and therefor not shown, you don't need the <? ?> and the echo simply just do like this:

$to = "$em";$subject = "Your Pawword";$message = "<html>Your password is : {$q['user_password']}<br />...

or

$to = "$em";$subject = "Your Pawword";$message = "<html>Your password is : ".$q['user_password']."<br />...

Whatever feels best for you

Link to comment
Share on other sites

I see the problem (I think...).mysql_fetch_object() doesn't return an array, it returns an object.To get the values from the object yo must use this "format":

$q->user_password

If you want to use arrays/hashes you must use mysql_fetch_array() or mysql_fetch_assoc().

Link to comment
Share on other sites

$get_user = mysql_query("SELECT * FROM associnfo WHERE user_email = '".$_POST['em']."'");$q = mysql_fetch_assoc($get_user);if(!$q) die("FAILED. The email address does not exsist.");  $to = "$em";$subject = "Your Password";$message = "<html>Your password is : ".$q['user_password']."<br />More Text";mail( $to, $subject, $message );echo "information send to the submitted email";

or

$get_user = mysql_query("SELECT * FROM associnfo WHERE user_email = '".$_POST['em']."'");$q = mysql_fetch_object($get_user);if(!$q) die("FAILED. The email address does not exsist.");  $to = "$em";$subject = "Your Password";$message = "<html>Your password is : ".$q->user_password."<br />More Text";mail( $to, $subject, $message );echo "information send to the submitted email";

Something like that (the last uses object and the first array/hash).

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...