473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

add quantities for system inventory

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('Connections/inventory.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
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'] ."'",
GetSQLValueString($_POST['newQuantity'], "int"));

mysql_select_db($database_inventory, $inventory);
$Result1 = mysql_query($insertSQL, $inventory) or die(mysql_error());

$updateGoTo = "add.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
// header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_inventory, $inventory);
$query_view = "SELECT * FROM register WHERE register.itemCode= '". $_POST['ID'] ."'";
$view = mysql_query($query_view, $inventory) or die(mysql_error());
$row_view = mysql_fetch_assoc($view);
$totalRows_view = mysql_num_rows($view);
if ($_POST['quantitybaru'])
{
echo $q = "SELECT * FROM register WHERE register.itemcode='". $_POST['ID'] ."'";
$rslt = mysql_query($q);
$curItem = mysql_fetch_array($rslt);
}
$sql = mysql_query("SELECT SUM(quantity) as quantity FROM register WHERE register.itemCode= '". $_POST['ID'] ."'");
while( $row=mysql_fetch_array($sql))
{
$newQuantity = $curItem['quantity'] + $_POST['quantitybaru'];
}
echo "total items= ".$newQuantity ;?>
<script LANGUAGE="JavaScript">
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.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled 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"><div align="center" class="style18 style19">ADD ITEM </div></td>
</tr>
<tr>
<td width="93"><span class="style11">Category</span></td>
<td width="154"><span class="style11"><?php echo $row_view['catName']; ?></span></td>
<td width="93"><span 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="quantitybaru" type="text" class="style11" id="quantitybaru" 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">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</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"><span 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_result($view);
?>[/php]
Mar 13 '07 #1
1 3091
ronverdonk
4,258 Expert 4TB
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
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...
5
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...
5
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...
5
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...
13
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...
2
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....
3
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...
2
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.