Hello, I am trying to query another table from the printer friendly page so as to populate the correct data based on a certain condition.
Below is what I have for the statement as of now:
// Print page: Before record processed
function BeforeProcessRowPrint(&$data)
{
global $conn;
$sql = sprintf("select * from user_accounts where employer='%s'", mysql_real_escape_string($data["employer"]));
$rs = db_query($sql, $conn);
while($dat = db_fetch_array($rs))
{
$_SESSION["empaddress"] = $dat["Employer_Address"];
$_SESSION["empstate"] = $dat["Employer_State"];
}
return true;
// return true if you like to display row on in the list
// return false otherwise
} // function BeforeProcessRowPrint
The problem is that the same Address and State are returned for EACH row that is processed. How can I create a loop to make it different for each record and query the correct data? Thanks!