Jump to content

[SOLVED] Export Access to Mysql


jvrothjr

Recommended Posts

Hay I know a few people have done this and just looking for a lil advice or code snippits

 

I have the code to display the tables in Access now I need to take the data from access and replace the data in mysql

 

The Access DB is the master and controled via are Doc Mang software blah blah  The day-to-day users and testing Equi.... us the mysql DB.

 

I have all the code to trigger the script for update once the DB is changed now just working on the mysql update side.

 

I was thinking of placing the data from  Access (at the same time it is being displayed) into an array then take that array and dump it into mysql

 

<?php
Step1("MCOVDutyCycle");
Step1("tdeviations");
Step1("typespecs");
Step1("unitspecs");

Function Step1($table) {
$con = odbc_connect('northwind','','');  
if (!$con) {exit("Connection Failed: " . $conn);}
	$sql="select * from ".$table;
	echo "Q String: ".$sql."<br>";
	$rs=odbc_exec($con,$sql) or die("Select failed");
	$myUtil = new Utilities();
	$myUtil->standard_table($rs);
odbc_close($con);
echo "Complete<br>";

}

class Utilities {
     function standard_table($result)
     {
         // Create field names for table header row
         $i = 0; 
         $fieldCount = odbc_num_fields($result); 
         echo "<table border=5 bordercolor=gray>";
         echo "<tr>";
         while ($i < $fieldCount) 
         { 
             $i++; 
             $fieldName = odbc_field_name($result, $i); 
             echo "<th>$fieldName</th>"; 
         } 
         echo "</tr>";
         // Create table data rows for query result
         while (odbc_fetch_row($result)) 
         {
             $i = 0; 
             echo "<tr>"; 
             while ($i < $fieldCount) 
             { 
                 $i++; 
                 $fieldData = trim(odbc_result($result, $i));
                 if ($fieldData  == "")
                     echo "<td> </td>";
                 else 
                     echo "<td>$fieldData</td>"; 
             } 
             echo "</tr>";
         }
         echo "</table>";
     }
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/60372-solved-export-access-to-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.