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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.