I have data I would like to extract from my SQL server and import it into MySQL.
I have the following query below, but it stops working at the INSERT statement.
Not sure what I am doing wrong.
<?php
$connection = @mysql_connect("localhost", "root", "password");
$db_name = "mysql_database";
$db = @mysql_select_db($db_name, $connection);
////////////////////////////////////////////////////////////////////////////////
$connect = odbc_connect("SQL_database", "user", "password");
$query = "SELECT * FROM Employee_Table";
$result = odbc_exec($connect, $query);
while(odbc_fetch_row($result)) {
$field1 = odbc_result($result, 'Employee_Name');
$sql = "INSERT INTO employees(Name) VALUES('$field1')";
$mysql_result = mysql_query($sql,$connection) or die('Getting an error here!');
}
?>