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
https://forums.phpfreaks.com/topic/251723-using-one-table-to-update-another/
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.

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.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.