Mysql Duplicate Entry Exception
Permalink
Prono is primary key in my table.
My entry data inserted in express when exception occurs but does not insert mysql table.
My code is the following and how to change not to insert in express when exception occurs.
try{
$productmaster = Express::buildEntry('product')
->setProno($_POST['txtPro'])
->setPro($_POST['txtPro'])
->setCa($_POST['txtCa'])
->setRe(date('Y-m-d'))
->setCha($userName)
->save();
}catch(Exception $e){
echo "<script type='text/javascript'>alert('aaa');</script>";
if ($e == 1062) {
$message = 'Duplicate Entry';
echo "<script type='text/javascript'>alert('$message');</script>";
}
}
My entry data inserted in express when exception occurs but does not insert mysql table.
My code is the following and how to change not to insert in express when exception occurs.
try{
$productmaster = Express::buildEntry('product')
->setProno($_POST['txtPro'])
->setPro($_POST['txtPro'])
->setCa($_POST['txtCa'])
->setRe(date('Y-m-d'))
->setCha($userName)
->save();
}catch(Exception $e){
echo "<script type='text/javascript'>alert('aaa');</script>";
if ($e == 1062) {
$message = 'Duplicate Entry';
echo "<script type='text/javascript'>alert('$message');</script>";
}
}