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

include("../../Connections/db_connection.php");
$table = "shop_inventory";
mysql_select_db("$db_database",$connect);
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";
}
else
{
"INSERT INTO $table (Asset, Manufacture, Model, Serial_Number, Type, Building, In_Shop, Room_Number)
VALUES
($_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";

mysql_close($connect);
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
Lennie McPherson, proprietor of Lennie''s Bail Bonds, needs to calculate the amount due for setting the bail. Lennie requires something of value as collateral, and his fee is 10%


Write a function named prob2.m which creates and returns an N×N identity matrix. An identity matrix is a square matrix with values of one on the main diagonal and zeros in all off-

Use recursion to de ne a function position which has as input an integer, a character and a string and returns the result of inserting the character in the string at the position s


In this activity, you are going to place components on a sheet and connect them with virtual wires to create a simple digital circuit. You will simulate the circuit to verify the c


1) Write a program that takes an input value (for example, a number 5). The output should be sum of all numbers from 1 to the value input by the user (in this example, the output w

Write your own version of the strcmp function string_compare. Supply a main program that will test each of the 3 differing outcomes. int string_compare(char *s, cha

Write a Fortran LOGICAL FUNCTION, called "is_prime", which determines if a given integer value is a prime number or not (A prime number is a natural number which has only two disti