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

Language-integrated query, Language-Integrated Query Language integrated qu...

Language-Integrated Query Language integrated query (LINQ, obvious "link") is a Enthusiasm .NET Structure element that contributes ancient data querying abilities to .NET dialects,

Design and implement program, Tamagochi were all the rage in the 90's as a ...

Tamagochi were all the rage in the 90's as a small toy that had limited functionality but modelled a pet. The "owner" could do the following • Feed the pet • Heal the pet

Namererror, how do u define a letter in python "NameError: name ''r'' is n...

how do u define a letter in python "NameError: name ''r'' is not defined"

String cost, A string S is said to be "Super ASCII", if it contains the cha...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Fortran programming, Question 1- In engineering applications it is often ne...

Question 1- In engineering applications it is often necessary to fit a straight line to a set of N points with known coordinates (xi, yi), where i indexes the points (N in total).

Matlab and Image Processing and Neural Network, I need to do image reconstr...

I need to do image reconstruction using Neural Network using Matlab

Write a program to handle a book collection, Write a program to handle a bo...

Write a program to handle a book collection. The data on each book might be title, author, publication date, book number and  cataloging details. Allow for adding or deleting books

Triple eigenvalue with 2 linearly independent eigenvectors, 1 Triple Eigenv...

1 Triple Eigenvalue with 2 Linearly Independent Eigenvectors       In this case we will have the eigen-value l with the two linearly independent eigenvectors  ?h 1 and  ?h 2

Retrive unicode text using vb.net ado.net, How Can I Retrive Unicode CSV Fi...

How Can I Retrive Unicode CSV File the ADO.net VB.net

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