I am having difficulty inserting data from one table into another, for example I have the budget table that has the items, but the items can be from different vendors, and when this budget is approved it should generate the purchase orders for the respective suppliers, eg:
Budget table
Assuming that SELECT * FROM orcamento WHERE orcamento = 330;
, I have:
Purchaseordertable
Iwouldliketocreateapurchaseorderforeachvendorasinthetablebelow,beingdismembered,asfollows:
I would like to create a purchase order with all items of the vendor as in the example of the purchase order table where an order was created with items Id 2 and 4 that correspond to the same vendor of code 55, I would like to use this functionality directly in the bank, informing only the budget id.
I'm using php with mysql, not mysqli.