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!

[HELP] Patulong naman po sa PHP.

essiebeee

Novice
Advanced Member
Messages
30
Reaction score
0
Points
26
KAILANGAN KO PO NG TULONG! Ordering system po kasi yun ginagawa ko. So ang balak ko po is kapag may umorder mababawasan po dun sa stock yung product na inorder. My big problem po is, paano po yun execution non? May table po ako ng products - product code, product name, description, pic, price. Tapos po may table din na inventory, na andun yun sa product code, quantity left, quantity sold, sales. Maraming salamat po. :help::help:
 
gwa ka order form,
lagay mo lahat ng info na kilangan mo sa order,
tapus kunin mo ung product code at quantity ng order, lagay mo ung value sa variable.
kunin mo din ung quantity left ng product code sa inventory table , lagay mo din sa variable.
tapus subtract mo lng ang quantity left sa order quantity.

Example
Code:
$order_qty = $_POST[order_qty];
$order_product_code = $_POST[order_product_code];

$sql = "SELECT * FROM inventory where product_code = '$order_product_code' ";
$result = mysql_query($sql);

if(mysql_num_rows($result) > 0){
while($row = mysql_fetch_assoc($result)){
$qty_left = $row['qutantity_left'];
}
}

$new_quantity = $qty_left -  $order_qty;

$sql = "UPDATE inventory SET quantity_left = '$new_quantity' WHERE product_code = '$product_code'";
if(mysql_query($sql)){
echo "Record Updated";
}else{
echo "Error try again";
}
 
gwa ka order form,
lagay mo lahat ng info na kilangan mo sa order,
tapus kunin mo ung product code at quantity ng order, lagay mo ung value sa variable.
kunin mo din ung quantity left ng product code sa inventory table , lagay mo din sa variable.
tapus subtract mo lng ang quantity left sa order quantity.

Example
Code:
$order_qty = $_POST[order_qty];
$order_product_code = $_POST[order_product_code];

$sql = "SELECT * FROM inventory where product_code = '$order_product_code' ";
$result = mysql_query($sql);

if(mysql_num_rows($result) > 0){
while($row = mysql_fetch_assoc($result)){
$qty_left = $row['qutantity_left'];
}
}

$new_quantity = $qty_left -  $order_qty;

$sql = "UPDATE inventory SET quantity_left = '$new_quantity' WHERE product_code = '$product_code'";
if(mysql_query($sql)){
echo "Record Updated";
}else{
echo "Error try again";
}

Sige po. Ittry ko. Salamat.
 
Back
Top Bottom