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

What are program visible and invisible resisters, What are program visible ...

What are program visible and invisible resisters? A4) Program visible is those registers that can be programmed by the users, or which are customizable, whereas Program invisible

Shell script to check a given number is palindrome or not, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Java string handling, Expertsmind brings you unique solution in java assig...

Expertsmind brings you unique solution in java assignments String Handling Series signifies a sequence of character types. It has set duration of personality sequence. Onc

Understanding the html document object model, At the core of DHTML is the D...

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

Windows card space, Windows Card Space Windows Card Space (codenamed Info C...

Windows Card Space Windows Card Space (codenamed Info Card), is Windows now-canceled customer application for the Identification Met system. Card Place is an instance of a class of

Program for nuclear reactor - embedded systems, Implement the "Nuclear Reac...

Implement the "Nuclear Reactor" example using the following:  An ISR triggered by a button press  A task to update the temperatures  A semaphore to communicate between the ISR and

Write a program to use a robot to move, Write a program to use a robot to m...

Write a program to use a robot to move the stack of blocks from a source location to a target location, based. Movement of robot arms, picking and dropping, can be controlled usi

Write a perl script to assign letter grades to the students, Tasks: Writ...

Tasks: Write a Perl script assignGrades.pl to assign letter grades to the students. Please use the classList2.txt file. Upon invoking, the script will access the file classL

I need help in travel and photo sharing website, Vacation Envy - Travel and...

Vacation Envy - Travel and Photo Sharing Website Site Overview- Vacation Envy is a travel as well as photo-sharing site. Make your travel map, share photos and show off al

SRGP, Implement the pull-down menu package

Implement the pull-down menu package

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