如何在pdo php中从databade编辑联接数据

时间:2018-08-03 20:09:13

标签: php

无法通过加入来更新数据,请团队帮助我以进行更新

 $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;
       }

1 个答案:

答案 0 :(得分:0)

您的语句格式不正确,没有SET语句。这就是你想要的吗?

  $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'
  ";