error deleting row from mysql database
I have written syntax to delete a row from a MYSQL database. This works
fine however i am now moving this to another page (copied and pasted) and
for some reason it will not work on the new page
I'm not sure how to add error reporting so just get server error
Here is the code
<?php
$prodID=$_GET["q"];
if ($prodID<="0"){echo( " <h3>This Product Does Not Exist</h2>
<table border='0'>
<tr>
<td>
<a href=catalogue.html'><button class='btn btn-info'><font
color='white'> Add A New product </font></a></button>
</td>
<td>
<a href='manageproducts.php'><button class='btn btn-info'><font
color='white'>Back to Products</font> </a>
</td>
</tr>
</table>
");
}
else
{
$con = mysql_connect("localhost","cl49-xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
@mysql_select_db("cl49-XXX", $con)or die( "Unable to select database");
$result=mysql_query("DELETE FROM products WHERE prodID=$prodID")or
die(mysql_error());
?>
No comments:
Post a Comment