this it not working i copied it from the web
i am new at PHP
i need to send user name and pswd to the user If anyone has the code for that please post
After sumitting i get this error
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in -- lost_passwordck.php on line 21
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /usr/home/destined/public_html/lost_passwordck.php on line 22
<?php
session_start();
session_register("session");
?>
<?
if (isset($_POST['submit'])){ $query="SELECT emailaddress,username,pwd FROM tbl_users WHERE tbl_users.emailaddress = '$emailaddress'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->emailaddress;// email is stored to a variable
if ($recs == 0) { echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='signup.php'> Sign UP </a> </center>"; exit;}
$headers4="admin@destinedtowin.org"; ///// Change this address within quotes to your address ///
$headers.="Reply-to: $headers4\n";
$headers .= "From: $headers4\n";
$headers .= "Errors-to: $headers4\n";
//$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;// for html mail un-comment this line
if(mail("$em","Your Request for login details","This is in response to your request for login detailst at site_name \n \nLogin ID: $row->username \n Password: $row->pwd \n\n Thank You \n \n siteadmin","$headers")){echo "<center><font face='Verdana' size='2' ><b>THANK YOU</b> <br>Your password is posted to your emil address . Please check your mail after some time. </center>";}
else{ echo " <center><font face='Verdana' size='2' color=red >There is some system problem in sending login details to your address. Please contact site-admin. <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
}
else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
?>