Php / mysql issues, computer programming, Programming Languages

Assignment Help:
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'');
?>

Related Discussions:- Php / mysql issues, computer programming

Differentiate between high level and low level languages, The languages use...

The languages used in the module are of a type known as high-level languages. There is another set of languages known as low-level languages. (a) Differentiate between high-leve

Multi-targeting .net structure, Support for Multi-Targeting The multi-targe...

Support for Multi-Targeting The multi-targeting function of Vision Facilities allows you specify the particular edition or account of the .NET Structure that is required for your p

Formulas, how do I change a existing formula with a new formula and it show...

how do I change a existing formula with a new formula and it show the result

CGI mailer Script, i neeed an CGI Script that send mass emails i need this...

i neeed an CGI Script that send mass emails i need this input fields Sender Name: Sender Email: Subject: Message: choose (HTML Or text ) , by default HTML Emails and send bu

What is an authentication subsystem, Question: (i) Each time a securit...

Question: (i) Each time a security mechanism is installed or deleted in a Digital UNIX system, SIA is involved. Draw a Security Integration Architecture diagram. (ii) How

Pseudocode for a program that reads a temperature, Write a pseudocode for a...

Write a pseudocode for a program that reads a temperature as a whole number from a user and outputs a “probable” season (winter, sprint, summer, or fall) depending on the temperatu

Oracal Query, Find out the selling cost average for packages developed in P...

Find out the selling cost average for packages developed in Pascal

Simple corba program, You are working in charge of a group of programmers a...

You are working in charge of a group of programmers at a software company. Your task is to assess and research CORBA and to produce a report to be given to the programmers detailin

Write the html code to bind this xml data, Question: (a) (i) Describe w...

Question: (a) (i) Describe what an XML Data Island is and outline the restrictions of using a Data Island. (ii) The following XML file book.xml is used to keep track of a l

Cobol program, need someone to write a simple cobol program for me..urgent

need someone to write a simple cobol program for me..urgent

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd