I have a form request_form.php, that is manage Purchase Request Form for request item.
Purchase_Request_No : (automatic – autoincrement)
Date :
Dept :
Supplier :
Item_Request :
Example have a 5 row :
1.
2.
3.
4.
5.
I want to make once Purchase Request have 1 Purchase_Request_No.
Example :
Purchase_Request_No : 17
Date :25-Jul-2012
Dept :Production
Supplier :Microsoft
Item_Request :
1.Windows XP Professional
2.Keyboard
3.Mouse
4.LCD Monitor
5.Speaker
So, how can I make it with 1 Purchase_Request_No with item request more than 1 item(in this case I put 5 items)?
Anyone can help me ?
Thanks for advance.
Hi all, back again now I already in coding the concept.
It’s successfully save the data into database, but still when insert 5 item, it submit the data per item per ID.
Example :
Item 1 – Computer (Purchase No 1)
Item 2 – Mouse (Purchase No 2)
That I wanted is :
Item 1 – Computer (Purchase No 1)
Item 2 – Mouse (Purchase No 1)
and here it’s my code :
I using purchase no with autoincrement.
<?php
$conn = oci_connect("system", "dev01");
$n = $_POST['jum'];
for ($i=1; $i<=$n; $i++)
{
$dept=$_POST['dept'];
$date_request=$_POST['date_request'];
$supplier=$_POST['supplier'];
$item=$_POST['item'.$i];
$qty=$_POST['qty'.$i];
$uprice=$_POST['uprice'.$i];
$total=$_POST['total'.$i];
$s = oci_parse($conn,
"insert into purchase_request(dept_id, supplier_id, date_request, item, qty, uprice, total_amount) values ('$dept', '$supplier', '$date_request', '$item'
, '$qty', '$uprice', '$total'
)");
$r = oci_execute($s);
oci_rollback($conn);
echo "Data was committed\n";
}
?>
Any idea ?
Have three tables. One would contain the products:
another contains the requests:
The third maps the first two together
(Alternately, you could make the ids of the products prime numbers and store the
itemscolumn as a multiple of the items. All you’d need to do is find the prime factors of theitemscolumn, and then you’ve got the list of items!*)*For some reason, no one at work thinks this is a good idea.