Jump to content

Recommended Posts

hi all,

 

just a couple of quick questions hopefully shouldn't be too difficult for you.

 

1) Have already got a script in place to search database if you forget your password, you enter the username and it searches details and then emails the password to the registered address. 

 

If i wanted to add a forgot username facility, could i modify my existing account to say something like

 

SELECT * from 'db' WHERE username=$_POST[posted username} OR WHERE firstname AND surname=$_POST[posted firstname],$_POST[surname];

 

or would i need to just create a seperate file for this?

 

2) Updates.  If i include a form to update members details say, firstname, surname, email address etc, and only the email address was filled in, if i updated all would this then wipe the data that was in the database for the other info or would it just update the email address as that is the only field in the form that has been filled in?

 

Cheers for any insight

 

Sudsy

Link to comment
https://forums.phpfreaks.com/topic/134177-solved-couple-of-mysql-questions/
Share on other sites

2) Updates.  If i include a form to update members details say, firstname, surname, email address etc, and only the email address was filled in, if i updated all would this then wipe the data that was in the database for the other info or would it just update the email address as that is the only field in the form that has been filled in?

 

Well, the best thing to do here is to output the users data to form fields and then update every column with those field values.

To allow him or her to get their username, you had better ask them to give you something that is unique, such as an email address...

 

$result = mysql_query("SELECT username, email from 'db' WHERE email = '$email_address'") or die(mysql_error());
$r = mysql_fetch_row($result);
if(mysql_num_rows($result) > 0){
$email_message = 'Your username is '.$r[1];
//Then send email - or something like that
}

Thanks for the replys.

 

Got the second one but not really sure what you mean with the updates.

 

Do you mean retrieve members details and then try to populate them into the update form ?

 

then resubmit to the database ?

 

if so i could get the details and then resubmit no probs

but as to how to populate the form ????

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.