I want to insert some data from a form to a database table "sumation". But it's not working. I use PhpStorm IDE and it's shows no data sources are configured to run this sql and sql dialect is not configured. Where is the problem ?
<?php
$db= new PDO('mysql:host=localhost;dbname=test;cahrset=utf8','root','');
if(isset($_POST['submit'])){
$id=$_POST['id'];
$first=$_POST['first'];
$second=$_POST['second'];
$third=$_POST['third'];
$sql="INSERT INTO sumation VALUES($id,'$first','$second','$third')";
$db->query($sql);
echo("<script>alert('Data Inserted Sucessfully !')</script>");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
ID: <input type="text" name="id"><br>
First: <input type="text" name="first"><br>
Second: <input type="text" name="second"><br>
Third: <input type="text" name="third"><br>
<button type="submit" class="btn-primary" name="submit">Insert </button>
</form>
</body>
</html>