How to pull data from one database to another? Please help
Posted: Sun Aug 16, 2009 11:40 am
Hi all,
I was wondering if anyone could tell me how to go about this - I am trying to select data from one database A and insert it into another database B. Database A is a DB2 database while B is Derby (if that helps). At the moment, I can get the data from A and display it on php page. The problem I have is how to go about inserting the data from A into B.
Here is the code that displays the returned resullts
My main objective for this is, I will be comparing B from A in future to pass a visual message to the user whenever a field changes in A. Any information you can give me would be greatly appreciated.
Kind regards.
I was wondering if anyone could tell me how to go about this - I am trying to select data from one database A and insert it into another database B. Database A is a DB2 database while B is Derby (if that helps). At the moment, I can get the data from A and display it on php page. The problem I have is how to go about inserting the data from A into B.
Here is the code that displays the returned resullts
Code: Select all
if (is_array($sql)) {
foreach ($sql as $row) {
print "\n<tr>";
foreach ($row as $columnName => $value) {
populate($row[$columnName]);
if ("cust_no" === $columnName)
{
print "\n\t<td nowrap><a href=\"lookup_link.php?$columnName=$row[$columnName]\">$row[$columnName]</a></td>";
print "\n";
}
else
{
print "\n\t<td nowrap>$row[$columnName]</td>";
print "\n";
}
}
print "\n</tr>";
}
print "\n</table>\n";
}
else if (is_null($sql)) {
// Error
echo "No";
}
My main objective for this is, I will be comparing B from A in future to pass a visual message to the user whenever a field changes in A. Any information you can give me would be greatly appreciated.
Kind regards.