I have several tables where the product code is set to unquie, how would I go about reporting duplicate entrys when new products are added?
At the moment this is the AddNew_product.php:
<?php
//log in
@mysql_connect($host,$user,$password) or die("Unable to connect with server!");
@mysql_select_db($database)or die("Unable to connect database, please try later!");
$id=mysql_real_escape_string($_POST['id']); //This is set to unique.
$name=mysql_real_escape_string($_POST['name']);
$info=mysql_real_escape_string($_POST['info']);
$pic=mysql_real_escape_string($_POST['pic']);
$lg_pic=mysql_real_escape_string($_POST['lg_pic']);
$price=mysql_real_escape_string($_POST['price']);
$query = "INSERT INTO floral VALUES ('$id','$name','$info','$pic','$lg_pic','$price')";
mysql_query($query);
header("Location: added.php");
mysql_close();
?>
I realise it probably involves the if statement but I'm not sure how to write it.
Many thanks in advance,
Linda