0

failure to update data from join please team help me so as to update

 $result =  "UPDATE manager m INNER JOIN user u ON
          m.manager_phone='$manager_phone', m.manager_fax='$manager_fax', m.manager_email='$manager_email', u.fullname='$fullname', u.address='$address',
                u.occupation='$occupation' WHERE manager_id='$id'";

        $stmt = $connpdo->prepare($result);
        $stmt->execute();
       if ($stmt)
       {
           echo "ok";
           exit;
       }
       else
       {
           echo "fail";
           exit;
       }
timah
  • 13
  • 1
  • 5
  • 1
    Unfortunately you can only update one table per statement. Take a look at this question for reference: https://stackoverflow.com/questions/2044467/how-to-update-two-tables-in-one-statement-in-sql-server-2005 – RToyo Aug 03 '18 at 20:13
  • You can update more than one table per update statement, depending on your database. What database are you using? – pendo Aug 03 '18 at 20:24
  • Did my answer help you get to where you were going? – pendo Aug 09 '18 at 19:36

1 Answers1

0

Your statement is malformed and there is no SET statement. Is this what you wanted?

  $result =  "UPDATE manager m 
          INNER JOIN user u ON m.manager_id = u.user_id
          SET m.manager_phone='$manager_phone', 
          m.manager_fax='$manager_fax', 
          m.manager_email='$manager_email', 
          u.fullname='$fullname', 
          u.address='$address',
          u.occupation='$occupation' 
          WHERE manager_id='$id'
  ";
pendo
  • 792
  • 2
  • 5
  • 27