\n"; while ($line = mysql_fetch_array($result, MYSQL_NUM)) { echo "\t\n"; foreach ($line as $col_value) { // for ($num = 1; $num <= 16; $num++) { // $num++; // $line[$num]=$col_value; echo "\t\t$col_value\n"; } echo "\t\n"; } echo "\n"; */ while ($line = mysql_fetch_array($result, MYSQL_NUM)) { for ($num = 0; $num < 16; $num++) { // here you can comment this out to match your case // I consider that the new horde must have the usernames as // user and NOT as user@domain anymore if ($num != 1) $new[$num] = str_replace("'","\'",$line[$num]); else list($new[$num],$domain) = split("@",$line[$num]); } // $nomes = str_replace("'","\'",$new[4]); //echo "\n$nomes\n"; echo "INSERT INTO turba_objects VALUES ('$new[0]','$new[1]','$new[14]',NULL,'$new[15]','$new[2]','$new[3]','$new[4]','$new[5]','$new[6]','$new[7]','$new[8]','$new[9]','$new[10]','$new[11]','$new[12]','$new[13]',NULL,NULL,NULL);\n"; } // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?>