I want to take a result of a Mysql query and insert that into a different table. I can get the result to echo on the screen but I can't seem to get it to work in the next query. Here's what I have:
$sql1="SELECT
Sum(vtiger_inventoryproductrel.extlistprice)
FROM
vtiger_inventoryproductrel
Inner Join vtiger_products ON vtiger_inventoryproductrel.productid = vtiger_products.productid
WHERE
vtiger_inventoryproductrel.id = '3824'";
$result = mysql_query($sql1, $conn) or trigger_error("SQL", E_USER_ERROR);
$productstotal = mysql_fetch_row($result);
//*************Update query to insert the Product total into the invoiceCF table****
$sql1="Update vtiger_invoicecf SET cf_603 = $productsubtotal where vtiger_invoicecf.invoiceid = '3824'";
$result1 = mysql_query($sql1, $conn) or trigger_error("SQL", E_USER_ERROR);
I get a Call to undefined MySql Fetch error from the first query. Can some one help show me what I have wrong?
Thanks
$sql1="SELECT
Sum(vtiger_inventoryproductrel.extlistprice)
FROM
vtiger_inventoryproductrel
Inner Join vtiger_products ON vtiger_inventoryproductrel.productid = vtiger_products.productid
WHERE
vtiger_inventoryproductrel.id = '3824'";
$result = mysql_query($sql1, $conn) or trigger_error("SQL", E_USER_ERROR);
$productstotal = mysql_fetch_row($result);
//*************Update query to insert the Product total into the invoiceCF table****
$sql1="Update vtiger_invoicecf SET cf_603 = $productsubtotal where vtiger_invoicecf.invoiceid = '3824'";
$result1 = mysql_query($sql1, $conn) or trigger_error("SQL", E_USER_ERROR);
I get a Call to undefined MySql Fetch error from the first query. Can some one help show me what I have wrong?
Thanks