thanks sir, honesty this is my real problem, why this code isnt working? its look like 2 db_query in one function isnt allowed
function add_stock_move($type, $stock_id, $trans_no, $location,
$date_, $reference, $quantity, $std_cost, $person_id=0, $show_or_hide=1,
$price=0, $discount_percent=0, $error_msg="")
{
$date = date2sql($date_);
$bomqty = "SELECT bom_quantity from ".TB_PREF."stock_master WHERE stock_id=".db_escape($stock_id);
$result = db_query($bomqty, "Error");
if (db_num_rows($bomqty)==1)
{
$row = db_fetch_row($result)
return $row[0];
} $nope = $row[0];
$sql = "INSERT INTO ".TB_PREF."stock_moves (stock_id, trans_no, type, loc_code,
tran_date, person_id, reference, qty, standard_cost, visible, price,
discount_percent) VALUES (".db_escape($stock_id)
.", ".db_escape($trans_no).", ".db_escape($type)
.", ".db_escape($location).", '$date', "
.db_escape($person_id).", ".db_escape($reference).", "
.db_escape($quantity).", ".db_escape($std_cost).","
.db_escape($show_or_hide).", "
.db_escape($price).", ".db_escape($nope).")";
if ($error_msg == "")
$error_msg = "The stock movement record cannot be inserted";
db_query($sql, $error_msg);
return db_insert_id();
}