Attempting to connect via ODBC on 2K3 Server and XP Pro I get the following (using CLI):
Firstly, a pop-up error message: The instruction at "[hex]" referenced memory at "[hex]". The memory could not be "written". Click on OK to terminate the program Click on CANCEL to debug the program
After clicking OK a second pop-up error appears: The instruction at "[hex]" referenced memory at "[hex]". The memory could not be "read". Click on OK to terminate the program Click on CANCEL to debug the program
(the [hex] addresses change each time).
The following is in the application log: Faulting application php.exe, version 5.2.1.1, faulting module msrd3x40.dll, version 4.0.6508.0, fault address [hex].
Followed by: Faulting application php.exe, version 5.2.1.1, faulting module ntdll.dll, version 5.2.3790.1830, fault address [hex].
Here is an example of the code that I'm trying to execute. It is a slightly complicated script that queries data from a table in an Access database and updates an identical table in a MySQL database with that data:
<?php
/*
Connect to Access database
*/
$db1 = odbc_connect('dsn','','');
if (!$db1)
{exit("Connect failed: " . $db1);}
/*
Query data and prepare array for MySQL insertion
*/
$cust_data = '';
$cust_query = "SELECT customerid, salutation, firstname, lastname, premise, street, district, town, county, postcode, phonenumber, phonenumber1, email, note, creationdate FROM tblcustomer ORDER BY customerid";
$res = odbc_exec($db1,$cust_query);
while($r = odbc_fetch_array($res)){
$cust_data .= "('".$r['customerid']."', '".$r['salutation']."', '".$r['firstname']."', '".$r['lastname']."', '".$r['premise']."', '".$r['street']."', '".$r['district']."', '".$r['town']."', '".$r['county']."', '".$r['postcode']."', '".$r['phonenumber']."', '".$r['phonenumber1']."', '".$r['email']."', '".$r['note']."', '".$r['creationdate']."', )";
}
$cust_data = substr($cust_data,0,-1);
if (!$cust_data)
{exit("SQL error retrieving customer data!");}
odbc_close($db1);
/*
Connect to MySQL database
*/
mysql_connect('127.0.0.1:3306', 'user', 'pass') or
die('Could not connect: ' . mysql_error());
mysql_select_db('db2');
/*
Populate/update table in MySQL database
*/
$cust_insert = "INSERT INTO tblcustomer (customerid, title, firstname, lastname, buildingname, streetaddress, district, town, county, postcode, landline, mobile, email, linenotes, creationdate) Values $cust_data ON DUPLICATE KEY UPDATE title=VALUES(title), firstname=VALUES(firstname), lastname=VALUES(lastname), streetaddress=VALUES(streetaddress), district=VALUES(district), town=VALUES(town), county=VALUES(county), postcode=VALUES(postcode), landline=VALUES(landline), mobile=VALUES(mobile), email=VALUES(email), linenotes=VALUES(linenotes), creationdate=VALUES(creationdate)";
mysql_query($cust_insert) or die(mysql_error());
?>