Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

HEEEELP! Order and inventory system

essiebeee

Novice
Advanced Member
Messages
30
Reaction score
0
Points
26
Patulong po please! Yung sa ordering system po na magbabawas sa inventory kapag may nagorder adon sa product.

Eto po sa tables.

productTbl
-id
-productName
-prodDesc
-prodPic
-prodPrice

InvenTbl
-id
-productName
-qtyLeft
-qtySold
-sales

salesTbl
-id
-productId
-qty
-date
-sales

PaHelp po! Di ko po alam kung pano magbabawas yung inorder don sa quantity eh.
PHP po. Salamat po!
 
gwa ka ng order form.
ito ung code. palitan mo lng ung mga variable names.
Code:
$inventory_ID = $_POST[inventory_ID];
$qty = $_POST['qty'];

$sql = "SELECT * FROM InvenTbl WHERE id = '$inventory_ID'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);

$qty_left = $row['qtyleft'];
$new_qty = $qty_left - $qty;

$sql = "UPDATE InvenTbl qtyleft = '$new_qty' WHERE id = '$inventory_ID'";
if(mysql_query($sql)){
echo "Record Updated";
}else{
echo "ERROR".mysql_error();
}

}else{
echo "No such ID recorded";
}
 
gwa ka ng order form.
ito ung code. palitan mo lng ung mga variable names.
Code:
$inventory_ID = $_POST[inventory_ID];
$qty = $_POST['qty'];

$sql = "SELECT * FROM InvenTbl WHERE id = '$inventory_ID'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);

$qty_left = $row['qtyleft'];
$new_qty = $qty_left - $qty;

$sql = "UPDATE InvenTbl qtyleft = '$new_qty' WHERE id = '$inventory_ID'";
if(mysql_query($sql)){
echo "Record Updated";
}else{
echo "ERROR".mysql_error();
}

}else{
echo "No such ID recorded";
}

Don na po sa mismong order page ilalagay yang code na yan?
 
gawa ka po muna ng form then sundin mo po yung code na ginawa po ni sir jack!

$sql = "SELECT * FROM InvenTbl WHERE id = '$inventory_ID'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);

$qty_left = $row['qtyleft'];
$new_qty = $qty_left - $qty;

example:
$qty_left (100) - $qty (10)
bali ang magiging total ng $new_qty (90)

$sql = "UPDATE InvenTbl qtyleft = '$new_qty' WHERE id = '$inventory_ID'"; <- then query para sa update at maisave yung new quantity mo po sa InvenTbl .
 
Sino ba ang programmer dyan within legazpi city area na may ready nang inventory system....
 
Back
Top Bottom