473,770 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add quantities for system inventory

1 New Member
haii........
,first at all sorry because im not good in english
i want to ask how to add quantity for inventory system .this is my form but it has error...
[php]
<?php require_once('C onnections/inventory.php') ; ?>
<?php
function GetSQLValueStri ng($theValue, $theType, $theDefinedValu e = "", $theNotDefinedV alue = "")
{
$theValue = (!get_magic_quo tes_gpc()) ? addslashes($the Value) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValu e) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theV alue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValu e : $theNotDefinedV alue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_ SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
echo $insertSQL = sprintf("UPDATE register set quantity='". $newQuantity ."'
WHERE itemcode='". $_POST['ID'] ."'",
GetSQLValueStri ng($_POST['newQuantity'], "int"));

mysql_select_db ($database_inve ntory, $inventory);
$Result1 = mysql_query($in sertSQL, $inventory) or die(mysql_error ());

$updateGoTo = "add.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($update GoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
// header(sprintf( "Location: %s", $updateGoTo));
}
mysql_select_db ($database_inve ntory, $inventory);
$query_view = "SELECT * FROM register WHERE register.itemCo de= '". $_POST['ID'] ."'";
$view = mysql_query($qu ery_view, $inventory) or die(mysql_error ());
$row_view = mysql_fetch_ass oc($view);
$totalRows_view = mysql_num_rows( $view);
if ($_POST['quantitybaru'])
{
echo $q = "SELECT * FROM register WHERE register.itemco de='". $_POST['ID'] ."'";
$rslt = mysql_query($q) ;
$curItem = mysql_fetch_arr ay($rslt);
}
$sql = mysql_query("SE LECT SUM(quantity) as quantity FROM register WHERE register.itemCo de= '". $_POST['ID'] ."'");
while( $row=mysql_fetc h_array($sql))
{
$newQuantity = $curItem['quantity'] + $_POST['quantitybaru'];
}
echo "total items= ".$newQuant ity ;?>
<script LANGUAGE="JavaS cript">
function confirmSubmit()
{
var agree=confirm(" Are you sure?");
if (agree)
return true ;
else
return false ;
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitl ed Document</title>
<style type="text/css">
<!--
.style11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; }
.style18 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.style19 {font-size: 11px}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction ; ?>">
<table width="623" border="1" align="center">
<tr>
<td colspan="4"><di v align="center" class="style18 style19">ADD ITEM </div></td>
</tr>
<tr>
<td width="93"><spa n class="style11" >Category</span></td>
<td width="154"><sp an class="style11" ><?php echo $row_view['catName']; ?></span></td>
<td width="93"><spa n class="style11" >Invoice No </span></td>
<td width="255" class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['invoice_no']; ?></span></td>
</tr>
<tr>
<td><span class="style11" >Item Code </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['itemCode']; ?></span></td>
<td><span class="style11" >Add Quantity </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<label>
<input name="quantityb aru" type="text" class="style11" id="quantitybar u" value=""/>

</label>
Balance :<?php echo $row_view['quantity']; ?></span></td>
</tr>
<tr>
<td><span class="style11" >Item</span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['itemName']; ?></span></td>
<td><span class="style11" >Price/Unit</span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['price_per_unit ']; ?></span></td>
</tr>
<tr>
<td><span class="style11" >Supplier</span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['supplier']; ?></span></td>
<td><span class="style11" >Date </span></td>

<td class="style11" ><span class="style11" >
<select name="select3" class="style11" >
<option value="2007">20 07</option>
<option value="2008">20 08</option>
<option value="2009">20 09</option>
<option value="2010">20 10</option>
<option value="2011">20 11</option>
</select>
-&nbsp;
<select name="select" class="style11" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
&nbsp;-&nbsp;
<select name="select2" class="style11" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
</span></td></tr>
<tr>
<td><span class="style11" >Address</span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['address']; ?></span></td>
<td><span class="style11" >Location</span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['location']; ?></span></td>
</tr>
<tr>
<td><span class="style11" >Order No </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['order_no']; ?></span></td>
<td><span class="style11" >Serial Number </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['serial_no']; ?></span></td>
</tr>
<tr>
<td height="20"><sp an class="style11" >Delievery Order </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['delivery_order ']; ?></span></td>
<td><span class="style11" >Staff Name </span></td>
<td class="style11" ><span class="style11" >
<label></label>
<?php echo $row_view['supervisor']; ?></span></td>
</tr>
</table>
<table width="646" border="0" align="center">
<tr>
<td><label>
<div align="center">
<input name="Submit" type="submit" class="style11" value="ADD ITEM" onClick="return confirmSubmit() " />
<input name="Submit2" type="submit" class="style11" value="CANCEL" />
</div>
</label></td>
</tr>
</table>
<p><label></label>
<label></label>
</p>
<input type="hidden" name="MM_update " value="form1">
</form>

</body>
</html>
<?php
mysql_free_resu lt($view);
?>[/php]
Mar 13 '07 #1
1 3122
ronverdonk
4,258 Recognized Expert Specialist
Welcome to TSDN!

Firstly, before you continue posting, read and follow the Posting Guidelines (top of this forum) and enclose your code within [php] ... [/php ] tags!! As you show it it is absolutely unreadable. And I will not even try to follow 246 lines of unstructured code.

Secondly: you say it "has an error" but that information can be called hardly enough to start looking at it. You need to give more information on your problem, like:

What is the nature of the problem? What have you done to pinpoint the code fragment in which the error occurred? Have you used any debug, echo, trace, etc. to see in what part of your code the error lies?

Ronald :cool:
Mar 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3381
by: Debbie Davis | last post by:
Greetings, I have been tasked with collecting the system information from several workstations and dumping the data into a SQL database using ASP. I have access to the servers but need to know how to approach this. What I need is the information that comes from the system info button in the help of many applications. Where does the code come from for the system summary? Is this something I can replicate in an intranet web? Many thanks...
5
1630
by: trode | last post by:
Hello all. For the first time, our company might make use of the MS Access portion of the office package. Problem is, I don't know it well enough to whip out a desired program. What we want to do is have two Tables. One table called PRODUCTS, containing "partnumbers" with "descriptions". The other table called "AUDITED PRODUCTS" that starts blank with the following fields: "Tag_number", "Quantity","partnumber", and "description".
5
3434
by: gregork | last post by:
I have painstakingly created an excel 2000 workbook for the very complex recipes I have to formulate. I have 2 sheets- 1 for configuring the recipe and 1 that is like an inventory of all the raw materials and their specifications. I have many lookup formulas on sheet1 that lookup the specs on the inventory. The problem is sheet 1 works really well but sheet 2 is not really performing as an inventory database like I want it to. The...
5
3291
by: tHeRoBeRtMiTcHeLL | last post by:
Well, I think I have bitten off a little more than I can chew (at least all at once), and I'm only trying to hammer out tables/relationships at the design level. Which translates to "Seasoned Access User needs expert advice or opinion on how to solve what was initially thought to be a fairly straightforward db design. I hope I can explain this in a way that makes it fairly easy to follow. Note, I have performed a fairly exhaustive...
13
3998
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate button "Unexpected Error":3251 operation is not supported for this type of object.The demo cd has two databases, one is called inventory and the other just has the tables for the design called inventory data. When you run inventory the database works...
2
8177
blyxx86
by: blyxx86 | last post by:
Great insight needed!! Good evening everyone.. I've come to a point where I can't even fathom how to go forward. I'm attempting to create a serialized inventory. I don't know where to begin. I need to keep a running inventory of serials by customer, by model and then by serial. Customer 1>Model1>Serial1
3
7000
by: cblank | last post by:
I need some help if someone could help me. I know everyone is asking for help in java. But for some reason I'm the same as everyone else when it comes to programming in java. I have an inventory program that I have built so far with no problem. But I cannot figure out how to turn it into a GUI application. This is what I'm trying to get it to do. Modify the Inventory Program to use a GUI. The GUI should display the information one product...
2
2541
by: pinkf24 | last post by:
I cannot figure out how to add the following: Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an item number one more than the previous last item. Add a Save button to the GUI that saves the...
3
4486
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee. Here is my Inventory program from 1 to 3: package...
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.