I want to copy selected fields to another table with a button.
I have orders table . I want to copy selected fields to orders2 table with a button. My friend gived me a code but this code not working. Can you say what is wrong. Thanks.
$check_sql=“select * from orders2 "
.” where orderno=".{orderid}
." and part_no=".{part_no};
//echo $check_sql;
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]})) // Row found
{
$delete_sql=“DELETE from orders2 "
.” where orderno=".{orderid}
." and part_no=".{part_no};
sc_exec_sql($delete_sql);
}
$insert_sql=“INSERT INTO orders2 (order2id, orderno, part_no, description, qty, each_net, total_net, delivery, note, comission, price_each, price_total) "
.” VALUES (’".{orderid}."’,’".{orderno}."’,’".{part_no}."’,’".{description}."’,’".{qty}."’,’".{each_net}."’,’".{total_net}."’,’".{delivery}."’,’".{note}."’,’"
.{comission}."’,’".{price_each}."’,’".{price_total}."’)";
sc_exec_sql($insert_sql);