Getting Data From Multiple Databases

I have two different databases one is foxpro(i am aware it is discontinued but our accounting package uses it i can query it via odbc tho, and the other is a mysql table,), in the one i have an item code and in the other the items description how can i go about getting the items description form the one by referencing the code?

my code so far is getting the data from the mysql all i need now is to grab the description from the other table,

 $sql = "SELECT ingCode, ingDesc, ingQty FROM compoundsmix WHERE compCode = '". $codeVar ."' AND Date = '". $date ."' AND Time = '". $time ."' ";
            if($result = mysqli_query($link, $sql)){
                if(mysqli_num_rows($result) > 0){

                    while($row = mysqli_fetch_array($result)){

                            $IngCode = $row['ingCode'] ;

                            $IngQty = $row['ingQty'] ;
                            echo "<tr>";
                            echo "<td>" . $IngCode . "</td>";
                            echo "<td>" . need this from other database . "</td>";
                            echo "<td>" . $IngQty . "</td>";
                            echo "</tr>";

so for example the mysql table contains

Code, Qty, and cost

and the Foxpro has the Code and the description

so my table output should look like

| Code | Description | Qty | Cost |

hope i explained that ok

If you can query the Foxpro DB via odbc, what is the exact problem with doing this and using the “code” as parameter within the WHERE clause?

To speed things up i would recommend to collect all involved codes from MySQL and query all corresponding descriptions from Foxpro at once and do the lookup with PHP afterwards, instead of making a query for every row.

1 Like

Sorted thanks, i did exactly that i did try it before but think i was overthinking it,

thanks again

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.