Jump to content

using one table to update another.


HDFilmMaker2112

Recommended Posts

I need help with the below MySQL query. I have two tables, with some information in one table that is needed to update the second table.

 

The below is not update the table:

elseif($_GET['forgot']=="password"){
if(email_verify($email)){
$new_password =& generatePassword();

$username=sanitize($_POST['username']);

$newpass=kam3($new_password);
$investors_forgot_password_sql1="UPDATE members SET password='$newpass' FROM application, members WHERE application.id=members.application_id AND username='$username' AND email='$email'";
$investors_forgot_password_result1=mysql_query($investors_forgot_password_sql1) or die(mysql_error());
$investors_forgot_password_num_rows1=mysql_affected_rows();

if($investors_forgot_password_num_rows1==1){
$content.='<p class="center">New password generated. It has been emailed to the email address provided.</p><br />';
$message='Some one (hopefully you) requested a new password be generated for your account on Make the Movie Happen.
Below is the newly generated password:

Password: '.$new_password.'

Once you log-in, please change your password.

Thank You,
Make the Movie Happen Support Team
';
mail($email, 'Make the Movie Happen - New Investor Password', $message, 'From: general@makethemoviehappen.com');
}
else{
header("Location: ./index.php?investors=forgot&e=1");
}
}
else{
header("Location: ./index.php?investors=forgot&e=2");
}
}

 

The mysql_error(); returns nothing.

Link to comment
Share on other sites

Still not working.

UPDATE members, application 
SET password='$newpass' 
WHERE application.id=members.application_id AND username='$username' AND email='$email'

 

I've also tried:

UPDATE members 
INNER JOIN application 
ON application.id=members.application_id 
SET password='$newpass' 
WHERE members.username='$username' AND application.email='$email'  

 

No luck.

Link to comment
Share on other sites

my issue was the elseif statement at the beginning. Should have been $_GET['get']=="password". PHP issue not Mysql.

 

UPDATE $tbl_name11, $tbl_name10 
SET password='$newpass' 
WHERE application.id=members.application_id AND username='$username' AND email='$email'

 

(I know that wouldn't have been possible to figure out from the excerpt that I posted.)

Link to comment
Share on other sites

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.