0

大家我的php程序有问题,我不明白问题出在哪里。当我执行第一个查询时一切正常,但第二个不起作用。我尝试放入mysql我没有解决问题,然后我认为我的变量有问题并更改了它们。但是还是什么都没有……你能帮帮我吗?...

//duplicate ressource 
        mysql_query("insert into ressource (id_mission, name, ressource_path, assignment, position)"
        ."select ".$new_id_mis.", name, ressource_path, assignment, position from ressource where id_mission=".$id_mission.";");
        /*testing in sql:
            insert into ressource (id_mission, name, ressource_path, assignment, position)
            select 70, name, ressource_path, assignment, position from ressource where id_mission=5;    */

        //duplicate report_part    NB: report_part.procedure => procedure is a key word in sql
        mysql_query("insert into report_part (id_mission, position, title, text, drawing, dataset, report_part.procedure, assignment)"
        ."select ".$new_id_mis.", position, title, text, drawing, dataset, report_part.procedure, assignment from report_part"
        ."where id_mission=".$id_mission.";");
        /*tested:
            insert into report_part (id_mission, position, title, text, drawing, dataset, report_part.procedure, assignment)
            select 17, position, title, text, drawing, dataset, report_part.procedure, assignment from report_part
            where id_mission=1;        */
4

1 回答 1

0

也许这应该有所帮助:

$strQry = "INSERT INTO resource (id_mission, name, ressource_path, assignment, position) 
SELECT ".$new_id_mis.", name, ressource_path, assignment, position 
FROM resource WHERE id_mission=".$id_mission;

mysql_query($strQry);
于 2013-09-08T06:32:32.557 回答