I have a function which calls from two different databases
one connection is defined as
$holmes = holmes_db();
the other is
$ifx = ifx_db();
If I define the coonection for the ifx connection at the beginning of the function it doesn't work but if I define it after I connected to the holmes database right before the the query to the ifx database it works. Why does the placement matter in defining the variable? Any help would be appreciated.
Below is the function and the places where it will and won't recognize the connection.
function FindPayee(&$vars)
{
$ifx = ifx_db(); --------- WON"T WORK IF
PLACED HERE
$sql = "select * from payee where py_lname like '";
$sql .= $vars["lname"];
$sql .= "%' ";
if ($vars["fname"])
{
$sql .= "AND py_fname like '" . $vars["fname"] . "%' ";
}
$sql .= "order by py_lname, py_fname";
$holmes = holmes_db();
$rid = iholmes_query($sql,$holmes);
while ($row = ifx_fetch_row($rid))
{
$my_ary[] = array (
$row["py_id"], // id
$row["py_attention"], // attn
$row["py_lname"], // lname
$row["py_fname"], // fname
$row["py_addr1"], // addr1
$row["py_addr2"], // addr2
$row["py_city"], // city
$row["py_st"], // st
$row["py_zip"], // zip
$row["py_phone"], // phone
$row["py_fax"], // fax
$row["py_ssn"] // ssn
);
}
$ifx = ifx_db(); -----WILL WORK IF PLACED HERE
$sql = "SELECT part_no, lname, fname, address, city, state, zip, sin ";
$sql .= "FROM pool where lname like '" . str_replace("'","''",$vars["lname"]) . "%' ";
$sql .= "ORDER BY lname, fname";
$rid = ifx_query($sql, $ifx);