Use id as primary key with auto increment
$stmt->execute();
$insertid = $conn->lastInsertId();
incremental id is always bigger than zero even on first record so that means it will always return a true value for id coz bigger than zero means true in PHP
if ($insertid)
echo "record inserted successfully";
else
echo "record insertion failed";