先SELECT table1 取得 name1 内容 $rs[name1]然后进行表2的查询SELECT * form table2 where name2 = $rs[name1]如果记录结果为空 则INSERT INTO table1 (no1,name1,time1) VALUES (??,??,??);INSERT INTO table2 (no1,name1,time1) VALUES (??,??,??);其余的自己丰富一下

解决方案 »

  1.   

    $no
    $name
    $time$ser1 = "select * from table1 where name1 like '%$name'"if(mysql_query($ser1))
    {
       $in1 ="insert into table1 values ('$no','$name','time')";
       if(mysql_query($in1))
       {
        $ser2 = "select * from table2 where name2 like '%$name'";
        if(mysql_query($ser1))
        {
        $in2 ="insert into table2 values ('$no','$name','time')";
         if(mysql_query($in2))
         {
           echo 'ok!'
         }
        }
       }
    }