SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Password Retrival + Name

    I have this password retrival script that is working just fine.
    The user inputs there email and the code looks for a matching email in the database and sends the password.
    What am trying to add is that it allsow looks for that users name $FirstName and once it send the email, it reads Dear $FirstName...,
    If this dosn't make to much sense padrone, been working on this site for a long time and the only thing coming out is echo:

    <?
    if ($inSendEmail == "") // ask for email
    {
    ?>
    <?
    }
    else // email password
    {
    mysql_connect($DbHostName,$DbUserName,$DbPassWord) or die("Sorry, the system is unable to communicate with database. Please try again in a few minutes.") ;

    KLean
    mysql_select_db($DatabaseName) ;

    $result = mysql_query("select password FROM $userDatabase WHERE Email='$email', Firstname");
    while ($row = mysql_fetch_row($result)) {
    $password = $row[0];
    if ($password <> "") {




    mail("$email", "$title Login Details", "
    Dear $FirstName,

    Thank you for requesting your password for XXXXXX

    Your User ID is: $email
    Your Password is: $password

    If you did not request your password, please notify us immediately at <XXXXx.

    Sincerely,

    XXXXX","From: $admin_email<XXXXXX>") or die("Sorry, the system s unable to send your passward at this time. Please try again in a few minutes.");
    echo "<center><span class='detTxt'>Your password has been sent to your E-mail address.</div></center>";
    }
    }
    mysql_close();

    if ($password == "") {
    echo "<span class='detTxt'>No password was found for this E-mail address. Please go back and try again.</span>";
    }
    }

    echo "</td></tr></table><BR>";

    ?>
    KLean

  2. #2
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $result = mysql_query("select password FROM $userDatabase WHERE Email='$email', Firstname");
    Did you not mean:
    $result = mysql_query("select password,Firstname FROM $userDatabase WHERE Email='$email'");

    You would also need:
    PHP Code:
    $Firstname=row['Firstname']; 
    the row[0] portion of your code says the password field is in the first field... it is easier to do this:

    PHP Code:
    $password=row['password']; 
    Last edited by dldeskins; Dec 7, 2002 at 12:51.
    Don Deskins
    Performance Parts

  3. #3
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    go it thanks.

    dldeskins

    I have this form that has 3 phone field. I have been trying to concatenate together and am no getting nowhere. I been gettting sugestions from a, but sow far havent gotten any where Any suggestions.

    <?
    [B]$myquery = "INSERT INTO Users (Day) value ($Day)

    $Day="($DayArea1."-".$DayExch."-".$DayExt"




    ?>

    <form name="form1" method="post" action="">
    <p>
    <input name="DayArea" type="text" id="DayArea" size="5">
    <input name="DayExch" type="text" id="DayExch" size="5">
    <input name="DayExt" type="text" id="DayExt" size="5">
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </p>

  4. #4
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to concantonate, use
    PHP Code:
    $Day $DayArea "-" $DayExch "-" .$DayExt
    I am not sure what your structure is for your database. Assuming that the entry is already there, that is, a certain user has a null field for the phone number, you will need a where clause and be in this form:
    update tablename
    set fieldname = variablename
    where fieldname = value ;

    If you truly want an insert (ie,the user has not been entered yet), make sure you cover all the fields in your table or you may have unintended results.

    Please see:
    http://sqlcourse.com/insert.html
    http://sqlcourse.com/update.html
    Don Deskins
    Performance Parts


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •