Edmhar Posted October 28, 2013 Share Posted October 28, 2013 Hi guys i want to ask how to get the value of the in the mysql for examplei have a equipments like camera so i have tbl_equipments with field of EquipmentID, EquipmentName, NoOfEquip, for example valuesEquiptmentID : 1001EquiptmentName: CameraNoOfEquip: 15So my customer can see if how many available camera from our websiteEXAMPLE 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 itemWhat maybe the code?I have no idea to make this. Quote Link to comment Share on other sites More sharing options...
ignace Posted October 28, 2013 Share Posted October 28, 2013 $quantity = 15; $order_quantity = 5; echo $quantity - $order_quantity; Quote Link to comment Share on other sites More sharing options...
Edmhar Posted October 29, 2013 Author Share Posted October 29, 2013 $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? Quote Link to comment Share on other sites More sharing options...
Edmhar Posted October 29, 2013 Author Share Posted October 29, 2013 (edited) 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 October 29, 2013 by Edmhar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.