Hello
Im trying to save data on_update/on_insert from a query but i cant get this to work, he saves all fields that i ask but not ["ex_rate1"].
my code:
$result1 = mysql_query("select * from angola_ex_rate WHERE active = '1'") or die (mysql_error());
$row = mysql_fetch_array ($result1);
$e["on_insert"] = array("add_rec", null, true);
function add_rec($data)
{
$data["params"]["INVOICER"] = $_SESSION["username"];
$data["params"]["INVOICE_DATE"] = strftime("%F %T");
$data["params"]["ex_rate"] = $row["ex_rate1"];
}
$e["on_update"] = array("update_rec", null, true);
function update_rec($data)
{
$data["params"]["INVOICER"] = $_SESSION["username"];
$data["params"]["INVOICE_DATE"] = strftime("%F %T");
$data["params"]["ex_rate"] = $row['ex_rate1'];
}
The variable $row is outside the scope of function.
You must declare it as global to use inside.
function ….
{
global $row;
}