Php / mysql issues, computer programming, Programming Languages

Im having problems with my php / mysql code.
I am trying to make it so it looks for an asset Number and if it is in the shop
if the asset is in the database but is not in the shop I want it to change it to be in the shop.
If the asset is not in the database I want it to create a new row with the information provided by my table.

here is all the php code

$table = "shop_inventory";
unset ($db_username, $db_password);

//$Log_Time = $_POST[''Log_Time''];
//$Log_Date = $_POST[''Log_Date''];
//$Log_Number= $_POST[''Log_Number''];
$Asset = $_POST[''Asset''];
$Manufacture = $_POST[''Manufacture''];
$Model = $_POST[''Model''];
$sn = $_POST[''sn''];
$Type = $_POST[''Type''];
$Building = $_POST[''Building''];
$RoomNumber = $_POST[''Room_Number''];
$In_Shop = $_POST[''In_Shop''];

$all = mysql_query(''SELECT * FROM $table'');
//$row = mysql_fetch_array($all);

if ("SELECT * FROM $table WHERE Asset=$_POST[Asset] and In_Shop=0")
mysql_query("UPDATE $table SET In_Shop=1 WHERE Asset=$_POST[Asset]");
echo "If ran";
"INSERT INTO $table (Asset, Manufacture, Model, Serial_Number, Type, Building, In_Shop, Room_Number)
($_POST[Asset], $_POST[Manufacture], $_POST[Model], $_POST[sn], $_POST[Type], $_POST[Building], $_POST[In_Shop], $_POST[Room_Number]";
echo "else ran";

echo "$Asset Added to Inventory";

header(''Refresh: 5; URL=../subpages/shopmain.php'');
Posted Date: 3/16/2012 10:47:33 PM | Location : United States

Related Discussions:- Php / mysql issues, computer programming, Assignment Help, Ask Question on Php / mysql issues, computer programming, Get Answer, Expert's Help, Php / mysql issues, computer programming Discussions

Write discussion on Php / mysql issues, computer programming
Your posts are moderated
Related Questions
Question 1 Explain the three traits of Object Oriented Programming Question 2 Write a note on (a) Assignment Operators                             b) Bitwise Operators.

Real Distinct Eigenvalues Under this case we'll have the real, distinct eigenvalues l 1 ≠l 2 ≠l 3 a and their related eigenvectors, ?h 1 , ?h 2 and  ?h 3   are guarantee

Hi, Can you do exercises: D2, D3, D4, and D5 on page 230 of the following book: . The book can be downloaded for free from t

Create a single page that demonstrates an XHTML form. The form should include all the fields you feel are necessary for submitting an order of books and must include at least one

At the core of DHTML is the Document Object Model, or DOM, which represents the HTML or XML of a Web page that is displayed in a browser. The Document Object Model that represents

Assignment is to create hijara game on any plate form, you can use any plate form you like or easy to you. For instance let's say you can use visual studio, game studio (Prefer to

A non-empty string β is called a repeat pre x of a string s if ββ is a pre x of s. Give a linear time algorithm to find the longest repeat prefix of s. Hint: Think of using lca

Define a Prolog predicate flatten(List, FlattenedList) that asserts List is any nested list of atoms and FlattenedList is the same list with the nesting removed. The atom [] should

Expertsmind brings you unique solution in java assignments Networking The term system selection represents composing applications that do across several gadgets (computers

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful