How do I get the output from the ODBC_FETCH_ROW into the INSERT vals(1,2,3...)? $sql1 query is a query with 9 known columns. It is getting a sql error and dying because the values aren't right from the FOR. Should I put the FOR values into an array and then put that into the VALUES to be inserted. That seems redundant because ODBC_FETCH_ROW is already in an array.
tnx,
define("NUM_OF_COLS", 9);
$cols="col1,col2,col3,col4,col5,col6,col7,col8,col9 ";
$cnx = odbc_connect("Driver={Microsoft ODBC for Oracle}; SERVER=myserver", "fsread","fsread");
$cur = odbc_exec($cnx,$sql1);
$cnt=0;
while( odbc_fetch_row( $cur )){
for ($i=1; $i <= NUM_OF_COLS; $i++){
odbc_result( $cur,$i);
$sql3= "INSERT INTO mydb.mytbl($cols) ";
$sql3.="VALUES($cur[0],$cur[1],$cur[2],$cur[3],$cur[4],$cur[5],$cur[6],$cur[7],$cur[8],$cur[9]) ";
echo $sql3 ."<br >";
$result=mysql_query($sql3);
if (!$result){die("<font color='red'>Invalid query:</font>".mysql_error()."<br>$sql3");}
}
$cnt++;
}