Dear Sir,
I have following codes to save record in MySql.
[PHP]<?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.
}
else
{
echo “
Record saved successfully.
”;}
mysql_close();
?>[/PHP]
These codes work fine, no error. But I need some modification as
In above code these values are going to save
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:
[PHP]echo “
Record saved successfully.
”; [/PHP]Before sending data to table it must check whether current SNO=18 already exist or not. If already exist then it must say:
[PHP]die “
Current SNO already exists .
”; [/PHP]Please help