Dear Sir,
I have following codes to save record in MySql.
<?php
include("connect.php");
$insert_query = "INSERT INTO ghee (sno,pack,weight) VALUES (18,'kk',80)";
$insertion_result = mysql_query($insert_query);
//check whether the data insertion was successful
if(!$insertion_result)
{
die("Sorry! Something went wrong.</p>");
}
else
{
echo "<p>Record saved successfully.</p>";
}
mysql_close();
?>
These codes work fine, no error. But I need some modification as
In above code these values are going to save
$insert_query = "INSERT INTO ghee (sno,pack,weight) VALUES (18,'kk',80)";
If I press submit button then values are written in dbf.
But if I press submit button MORE THAN ONE TIME then everytime it says:
echo "<p>Record saved successfully.</p>";
Before sending data to table it must check whether current SNO=18 already exist or not. If already exist then it must say:
die "<p>Current SNO=18 already exists .</p>";
Please help