Hi,
I am having diffculty in my administration page. Half of the code is correct but the other half I think is wrong. I am working with two tables to update the information. One is "products" and the other is "color". The product information work but the color information is displaying a parse error.
May some one check my coding to see what I am doing wrong?
<?php $delete = $_POST['button'];
if ($delete == "Delete Product")
{
$prodid = $_POST['prodid'];
$query = "DELETE from products WHERE prodid = $prodid";
$result = mysql_query($query);
if ($result)
{
echo "<h2>Product: $prodid deleted</h2>\n";
exit;
} else
{
echo "<h2>Problem deleting $prodid</h2>\n";
exit;
}
} else
{
$prodid = $_POST['prodid'];
$catid = $_POST['catid'];
$description = $_POST['description'];
$price = $_POST['price'];
$detail = $_POST['detail'];
$quantity = $_POST['quantity'];
if (get_magic_quotes_gpc())
{
$description = stripshlashes($desription);
}
$description = mysql_real_escape_string($description); if (isset($_POST['onsale']))
$onsale = 1;
else
$onsale = 0; $PictName = $_FILES['picture']['name']; if ($PictName)
{
$thumbnail = getThumb($_FILES['picture']);
$thumbnail = mysql_real_escape_string($thumbnail);
$query = "UPDATE products SET catid='$catid', description = '$description', " .
"price = $price, quantity = $quantity, detail = '$detail', onsale = $onsale, picture = '$thumbnail' " .
"WHERE prodid = $prodid";
}
else
{
$query = "UPDATE products SET catid='$catid', description = '$description', " .
"price = $price, quantity = $quantity, detail = '$detail', onsale = $onsale " .
"WHERE prodid = $prodid";
} $result = mysql_query($query) or die(mysql_error());
if ($result)
{
echo "<h2>Product information changed.</h2>\n";
}
else
{
echo "<h2>Sorry, I could not change the product information.</h2>\n";
}
}
//Color update
$delete = $_POST['button'];
if ($delete == "Delete Product")
{
$colorid = $_POST['colorid'];
$query = "DELETE from color WHERE colorid = $colorid";
$result = mysql_query($query);
if ($result)
{
echo "<h2>Color: $colorid deleted</h2>\n";
exit;
} else
{
echo "<h2>Problem deleting $colorid</h2>\n";
exit;
}
}
else
{
$colorid = $_POST['colorid'];
$item_color=$_POST['item_color'];
if (get_magic_quotes_gpc())
{
$item_color = stripshlashes($item_color);
}
$item_color = mysql_real_escape_string($item_color);
$query = "UPDATE color
SET item_color='$item_color'
WHERE colorid = $colorid";
}
else
{
} $result = mysql_query($query) or die(mysql_error());
if ($result)
{
echo "<h2>Color information changed.</h2>\n";
}
else
{
echo "<h2>Sorry, I could not change the color information.</h2>\n";
}
}
?>