更新单个查询以将值插入2个不同的表中

时间:2017-03-08 18:19:47

标签: mysql mysqli mysql-error-1064

我在将值更新到两个不同的表时遇到了麻烦,在一个表中它被插入但在另一个表中它根本没有反映。

请建议我在此代码中进行哪些更改。它只是为我提供了进一步使用代码的障碍。

$conn = mysql_connect('localhost', 'root', '');

mysql_select_db('kuidfc_project_monitoring', $conn);

$insert_query= mysql_query("UPDATE daily_progress_demo 
    SET startdate= '$startdate', 
    users = '$users', 
    name_of_work = '$name_of_work', 
    package_no = '$package_no', 
    contractor_name = '$contractor_name',
    project_name = '$project_name',
    work_location = '$work_location',
    work_type = '$work_type',
    work_component = '$work_component',
    date_of_contract_awarded = '$date_of_contract_awarded',
    enddate = '$enddate',
    boq= '$boq',
    original_contract_value = '$original_contract_value',
    acheived_till_date = '$total_progress_till_date',
    daily_progress = '$daily_progress',
    total_progress_till_date = '$total_progress_till_date',
    balanced_work = '$balanced_work',
    diffdate = '$diffdate',
    per_date_rate = '$per_date_rate',
    comments = '$comments' 
    WHERE id = '$id' ");

$update_query = mysql_query("UPDATE packages 
    set acheived_till_date = '$acheived_till_date', 
    per_date_rate = '$per_date_rate' 
    WHERE id = '$id' ");

// $var = mysql_query($con,$sql1,$conn);

mysqli_multi_query($conn, $insert_query.$update_query);

0 个答案:

没有答案