$conn=new com("ADODB.Connection");
 $connstr="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=".realpath("d:/web/tiku.mdb");
 $conn->Open($connstr);
 $rs = new com("ADODB.RecordSet");
 $rs_1=new com("ADODB.RecordSet");
 $rs->Open("select * from fill_table",$conn,1,1);
 $rs_1->Open("select * from stud_answer_table",$conn,1,1);
这种方式的链接
stud_answer_table 是空的
我想循环增加记录 可是不太会用sql语句 里面也没有addnew语句
请问该怎么写
 INSERT INTO person (stud_id,question_type,question_id) 
                 VALUES ($number, 'fill_table', $rs->fields[0]);
insert 语句就这样

解决方案 »

  1.   

    循环增加数据,一般不是通过SQL语句来增加的,而是辅助脚本程序来完成的。一般是借助于for循环之类的另外,虽然PHP对绝大部分的数据库都是支持的,但我还是建议楼主不要使用PHP+ACCESS的,还是改用mysql吧,不信你可以在论坛里调查一下,几乎没有人用你的这种搭配,虽然理论上可以。
      

  2.   


    楼主是不是想查表INSERT的:$res="select * from fill_table";
    $cur=odbc_exec($conn,$res);
    while(odbc_fetch_row($cur)) 
    { $add="INSERT INTO person (stud_id,question_type,question_id) 
                    VALUES ($number, 'fill_table', odbc_result($cur,"字段");)"; odbc_exec($conn,$add);}
      

  3.   

    可是我只会access的 而且数据量也不是很大 用sql 我还得费好大劲取了解
    没有人用过么
    就差这个insert了