Jump to content

LOGICAL OPERATION FOR PHP WITH MYSQL (INVENTORY SYSTEM)


Edmhar

Recommended Posts

Hi guys i want to ask how to get the value of the in the mysql for  example

i have a equipments like camera

so i have  tbl_equipments with field of  EquipmentID, EquipmentName, NoOfEquip,  

 

for example values

EquiptmentID : 1001
EquiptmentName: Camera
NoOfEquip: 15

So my customer can see if how many available camera from our website

EXAMPLE

A customer rent a camera for 5 pcs 

if i refresh the page the remaining  camera items is 10 

and i that customer back that item item

What maybe the code?

I have no idea to make this.

Link to comment
Share on other sites

$quantity = 15;
$order_quantity = 5;

echo $quantity - $order_quantity;

I will not set the 5 pcs in the code 

 

the number of order will be input sometimes it will be 1 or 2 etc. depends to the customer 

and how i will call this from mysql?

 

 

 

Link to comment
Share on other sites

the order must not have set value it must be inputed by the admin who in charge in sales.

 

<?php

include 'connect.php';

//this item order must be input by officer in charge am i correct?


$itemorder = "";

$query ="SELECT * FROM tbl_equipment WHERE Equip_ID ='".$itemid."' AND Equip_name ='".$itemname."' AND EquipVolume = '".$itemstock."' ";
query

echo  $itemname;
echo  $itemid;


echo  $itemstock - $itemorder;

//for example  stock of camera is 15 and a customer rent 5 pcs so in my admin page i will input input the  number of order and  so the other customer will see after they refresh is 10 pcs ony
// It must have effect in my database so im thinking i will use UPDATE but i dont know how to input it in
// then if item went down to 0 it will show The item is 0 with UNAVAILBLE   



?>




<?php

$conn_err ='Cant Connect';

$mysql_host = 'localhost';
$mysql_itemid = 'root';

$mysql_db = 'mis';

if (!@mysql_connect($mysql_host, $mysql_itemid)||!@mysql_select_db($mysql_db))  {
  die($conn_err);


}

?>

this is my connect.php

Edited by Edmhar
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.